A, Date class
1, the configuration of the method:
The first: Date time = new Date (): Get the current time Date
The second: Date time = new Date (long date);
Date time = new Date(10000000000L):
2, a common method
long time = time.getTime (); return value corresponding to the time in milliseconds.
Two, DateFormat type (format date)
Notes: This is an abstract class, can not be instantiated, use subclasses
= New new SDF the SimpleDateFormat the SimpleDateFormat (time format);
sdf.format(Date date):传入Date类型 返回被格式化的字符串
sdf.parse (String str): Returns the specified string passed in a Date type. Note: The string to be passed in accordance with the specified date format
Three, Calendar class (class calendar)
Notes: This is an abstract class, to be called getInstance () method returns the Calendar class
1, the common method
add (int field, int amount): The first parameter is a field to be operated, the second parameter is the number of offset.
set (): method to set the time. A plurality of overload, may be provided
getTime (): returns a Date object
note:
West began the week of Sunday, China Monday.
In the Calendar class, the representation of a month is 0-11 representatives from January to December.