Summary of Java methods for processing date and time
1、 Java util. Calendar introduction
The calendar class is an abstract class that is associated with a set of events such as year, month and day for a specific moment_ OF_ The conversion between calendar fields such as month and hour provides some methods, and provides some methods for operating calendar fields (such as obtaining the date of the next week). The moment can be expressed in milliseconds, which is the offset from the epoch (i.e. 00:00.000, Gregorian calendar, January 1, 1970, Greenwich mean time).
2、 Simple example
perhaps
2、 Construction specific time
The parameters of Gregorian calendar construction method are: year, month - 1, day, hour, minute and second
perhaps
3、 Take each part of the date
Add 1 to the month
4、 Gets the maximum number of days in the current month
5、 Take the last day of the month
6、 Take the first day of the month
7、 Find the number of days between two dates
8、 Date one year ago
9、 Date after one year
10、 Time after 10 hours
11、 Time 10 hours ago
12、 Monday and Sunday of the current date
12、 Gets the week of the current date, which week of the year it belongs to
summary
The above is the whole content of this article. I hope the content of this article can bring some help to your study or work. If you have any questions, you can leave a message.