Traditional Culture Encyclopedia - Almanac inquiry - How to add alarm clock function to perpetual calendar program written by java

How to add alarm clock function to perpetual calendar program written by java

import Java . text . simple date format;

Import java.util.calendar;

Public class test date {

Public static final string [] weeks = {Tian, Yi, Er, San, Si, Wu and Liu};

Public static void main(String[] args) {

calendar c = calendar . getinstance();

Calendar. Year, 2011); //20 1 1 year

Calendar. Month, 0); //Calendar class in //java//Month starts from 0, and 0 stands for January.

Calendar. DATE, 1); //No.1

Int day = c.get (calendar. Day of the week); //What day is it this week? 1 stands for Sunday ... 7 stands for Saturday.

System.out.println (new simple date format ("yyyy-MM-dd"). format(c . gettime()));

system . out . println(“week“+weeks【day- 1】);

}

}

Write the above test code as method parameters named year, month and day. Of course, calendars have many functions, such as the day of the week and the month of the year. ...