Summary of learning contents of textbook 13.1 recognize time and date
- Greenwich Mean Time (GMT): By observing the sun, because the Earth's orbit is elliptical and at a different speed, its autobiography slows down and causes errors.
- World Time (UT): By observing distant stars crossing the Meridian, the Earth's rotation speed is affected by the error.
- International Atomic Time (TAI): The International unit of the second is defined as the time spent on the radiation vibrations of cesium atoms for 9,192,631,770 weeks.
- World coordinated Time (UTC): Keep Tai and UT time errors too large with leap seconds correction.
- Unix Time: Unix system time notation, defined as the number of seconds elapsed from January 1, 1970 UTC, regardless of the leap second correction.
- Epoch: At a particular time, at a certain moment in the timeline.
- Julian calendar: The predecessor of the current Gregorian calendar, fixed the Roman calendar three years set a leap year error, four years to change a leap.
- Gregorian calendar: Reformed the Julian calendar, the next day of the Julian calendar on Thursday, October 4, 1582, is scheduled for the Gregorian calendar October 15, 1582 Friday.
- ISO 8601 Standard: Data Interchange Format for a unified time date.
- UTC offset: The precision is offset by 1 hours per 15 degrees, usually representing the z symbol.
- Daylight saving time: Summer and winter sunshine time difference is very large when implemented.
13.2 Understanding Date and Calendar
system.currenttimemillis () method, which returns a long integer representing the number of milliseconds since January 1, 1970 0:0 0 seconds 0 milliseconds to date. Date has two constructors that can be used, one can be constructed using the epoch millisecond number, the other is no argument constructor, and the interior is also using system.currenttimemillis () Gets the number of milliseconds, calls gettime () obtains an internally saved epoch millisecond value.
The responsibility for the processing of the string time format falls to the java.text.DateFormat body. It can be formatted by various static methods of Dateform, and can also be customized using pattern strings. the Parse () method to parse the specified string into a date instance .
- Date is recommended as an instantaneous representation on the timeline, to format the time date through DateFormat, and if you want to get a time-date information, or to manipulate the time-date, you can use the calendar.
- To create a calendar instance, you can use the Get () method and specify the fields on the calendar. Use the Add () method to adapt the time, using the roll () method to only add to a field in the date.
- When using the calendar, the time zone information is not used, which is used in this default time zone, and you can use Java.util.TImeZone's Getdefault () to get the default time zone information
- The available ID can be obtained using timezone.getavailableids () and it will return string[]
13.3 JDK8 New Time Date API
- LocalDateTime only includes time and date, localdate only dates, localtime only time, they are all about time, no time zone information.
- If your time date requires time zones, you can supplement the missing information based on LocalDateTime, Localdate, localtime, and so on.
- If you want to get numbers that represent the month, do not use the Oridinal () method, because Oridinal () is the order in which the enum is defined, starting with 0, to get the number of months represented by the GetValue () method.
- In the new time and date API, the UTC offset is separate from the time zone concept, and offsetdatetime purely represents the UTC offset, using ISO 8601. If you only want to represent 2014, you can use year, if you want to represent 2014/5, you can use Yearmonth, if you want to represent only May, you can use month, if you want to represent 5/4, you can use MonthDay, where month is an enum type, If you want to get numbers that represent the month, do not use the Oridinal () method, because Oridinal () is the order in which the enum is defined, starting with 0, to get the number of months represented by the GetValue () method.
- The operation of Time: Period and duration at first glance some difficult difference, period is the date difference, between () method only accept Localdate, do not represent smaller units than "day". However duration is a time difference, the between () method can accept LocalDateTime (), Localdate (), localtime (), which do not represent larger units than "days".
Code Hosting Scenarios
Other (sentiment, thinking, etc., optional)
I feel this semester I did a lot of useless things, this semester's major is not like the previous semester in the spare time to calm down the heart to good looking, I do not want to deceive themselves, will not be, learn not to understand is not understand, but do not understand does not mean to give up, even climb to climb to the end. This Monday from the beginning to look at the Java video screen, the feeling of super-good, although some things are cheating oneself deceive themselves, but I think value, because I would not end up getting nothing. Inevitably have the natural self-pity emotion, inevitably oneself moved oneself, only has to keep fresh, can see the real value.
20145235 Java programming 7th Week of study summary