Time
class has a toMillis(ignoreDaylightSavings)
method, this is merely a convenience to pass to methods that expect time in milliseconds. The time value is only precise to one second; the milliseconds portion is always 000
. If in a loop you do1410543204000
, until the next second has started, at which time 1410543205000
will begin to repeat.Time.getCurrentTimezone()
, or else you will get the current time in UTC.System.currentTimeMillis()
which is standard in Java. Then you can use it to create a dateSimpleDateFormat
from here.Instant
Instant
is a moment on the timeline in UTC with resolution up to nanoseconds.ZoneId
) to get a ZonedDateTime
. If you omit the time zone your JVM’s current default time zone is implicitly applied. Better to specify explicitly the desired/expected time zone.continent/region
such as America/Montreal
, Europe/Brussels
, or Asia/Kolkata
. Never use the 3-4 letter abbreviations such as EST
or IST
as they are neither standardized nor unique.String
as a textual representation of the date-time value. You can go with a standard format, your own custom format, or an automatically localized format.toString
methods to get text formatted using the common and sensible ISO 8601 standard. ZonedDateTime
, the toString
method extends the ISO 8601 standard by appending the name of the time zone in square brackets. Extremely useful and important information, but not standard.DateTimeFormatter
class.Locale
for a human language (English, French, etc.) to use in translating the name of day/month and also in defining cultural norms such as the order of year and month and date. Note that Locale
has nothing to do with time zone. java.util.Date
, Calendar
, & SimpleDateFormat
.java.sql.*
classes.Interval
, YearWeek
, YearQuarter
, and more.