TL;DR
Instant.now() // Current moment in UTC.
, .
- , UTC , 12:00 1 .
- java.time,
Instant Date.
, java.time.
, toString JVMs, , . A Date UTC. . , .
Instant UTC
Instant UTC ( (9) ).
Instant instant = Instant.now() ; // Current moment in UTC.
instant.toString(): 2018-02-11T21: 07: 02.315283Z
, java.time, 1970 UTC, : Instant.EPOCH.
Instant.EPOCH.toString(): 1970-01-01T00: 00: 00Z
OffsetDateTime
, , , Instant OffsetDateTime ZoneOffset.UTC.
OffsetDateTime odt = instant.atOffset( ZoneOffset.UTC ) ;
ISO 8601
continent/region, America/Montreal, Africa/Casablanca Pacific/Auckland. 3-4 , EST IST CET, , (!).
ZoneId z = ZoneId.of( "Europe/Paris" ) ;
ZonedDateTime zdt = instant.atZone( z ) ;
zdt.toString(): 2018-02-11T22: 07: 02.315283 + 01: 00 [/]
java.time .
ZonedDateTime zdtEpochParis = Instant.EPOCH.atZone( z ) ;
zdtEpochParis.toString(): 1970-01-01T01: 00 + 01: 00 [/]
, .
ZonedDateTime zdtEpochMontreal = Instant.EPOCH.atZone( ZoneId.of( "America/Montreal" ) ) ;
zdtEpochMontreal.toString(): 1969-12-31T19: 00-05: 00 [/]
java.time
java.time Java 8 . legacy -, java.util.Date, Calendar SimpleDateFormat.
Joda-Time, , java.time.
, . Oracle. Qaru . JSR 310.
JDBC-, JDBC 4.2 java.time- . java.sql. * Classes.
java.time?
The ThreeTen-Extra project extends java.time with additional classes. This project is proof of possible future additions to java.time. Here you can find useful classes, such as Interval, YearWeek, YearQuarterand longer .