7th Week Study Summary

Source: Internet
Author: User

20145339 Tong Zudaj Java 7th Week study summary time measurement of learning content

Greenwich Mean Time, GMT, by observing the sun; when the world, UT; international atoms, TAI; World coordination Time, Utc;unix time, the number of seconds elapsed from January 1, 1970 00:00:00 as the starting point, regardless of the leap second correction; epoch, The number of milliseconds elapsed from January 1, 1970 00:00:00 to the starting point.

Calendar Introduction

Julian Calendar, four years a leap; the Gregorian calendar reformed the Julian calendar; the ISO 8601 standard is mostly the same as the Gregorian calendar in the data definition. Recognize daylight saving time in time zones.

Date

The epoch milliseconds can be obtained using each gettime of the date instance, and the **data instance is used only as a moment on the timeline, and the string format can be processed using DataFormat, respectively getdateinstance, Gettimeinstance, Getdatetimeinstance

DateFormat

Java.text.DateFormat the string time format processing, DataFormat is an abstract class, its operation class is java.text.simpledataformat,getdatainstance (), Static usages such as gettimeinstance (), getdatatimeinstance (), or Simpledataformat instances can be built directly, or using DataFormat, directly building SimpleDateFormat, You can customize the string format the parse method can dissect a specified string into a date instance

Calendar

The calendar instance obtains a time-date information or operates on a time-date; Calendar is an abstract class, Java.util.GregorianCalendar is its subclass, through the calendar getinstance () to obtain the calendar instance, the default is to obtain the GregorianCalendar instance; Compare two calendar time and date successively, use after () or before () method; After getting the calendar instance, you can get the date information, can be set, can be used to change the operation.

TimeZone

TimeZone's Getdefault can obtain the default time zone information; Calender can specify timezone when calling getinstance (), and if a calender instance has been obtained, the time zone can be set by means of Settimezone ().

Machine-time View API

The date instance represents only the time information of the machine view; The static method of using instant now () Gets the instant instance, Ofepochmilli () can specify the Java epoch milliseconds, ofepochsecod () specify the number of seconds After obtaining the instant instance, you can use Plussecond (), Plusmillis (), Plusnanos (), Minusseconds (), Minusmillis (), Minusnanos () to do the operation on the timeline, Returns a new instant instance that represents the time after the operation.

API for Human time perspective

The date instance represents only the time information of the machine view, which can be supplemented on the basis of the above classes by using Zoneddatetime, etc., Month is the enum type, the number representing the month is obtained, the month is obtained by the GetValue () method, Instead of using the Oridinal () method.

Temporalamount

Time measurement, new time and date are defined using the API class duration, for year, month, day, and week date difference, you can use period class definition, static method Ofdays (), Ofmonths (), Ofweeks (), return period instance.

Temporalunit

Another overloaded version of the Plus () method, which accepts Java.time.temporal.TemporalUnit instances, Java.time.temporal.ChronoUnit is actually doing the class, using the enum to do it. Temporal plus () is defined on the temporal interface, Instant, Localdate, LocalDateTime, Locattime, Offsettime, zoneddatetime, etc., all operated temporal Interface.

Temporalaccessor

Temporal is a sub-interface of Temporalaccessor.

Calendar system Design

DK8 uses a yearly calendar system design, which means that the classes in the Java.time suite use a single ISO8601 calendar system when they need to implement a calendar system. Classes that require explicit implementation of the Java.time.chrono.Chronology interface.

Problems in teaching materials learning and the solving process

The textbook hasn't looked ready to see how much homework I haven't seen now.

Harvest

Cannot convert Object to Date can only be re-expressed with calendar

Learning sentiment

I'm still a little confused about this Java knocking a lot of code feel no use

7th Week Study Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.