Date and Time
Use different libraries for differnt needs
LocalDate
for just the dateLocalTime
for just the timeLocalDateTime
for both time and dateZoneDateTime
for time, date and time zone
LocalDate
Examples:
The date to day is 13 May 2018
NOTE the return values is just the toString() representation of LocalDate.
Getting current date, in format YYYY-MM-DD
Can do some maths with the date
There are lots of methods to use
Can do some comparisions
Formatting the date
Parsing string date
Note the pattern of formatter matches the string representation of the date, and thus can turn into LocalDate format
Creating Date
Get parts of the date
Alter parts of the date
LocalTime
Very similar methods to those in LocalDate
LocalDateTime
Very similar methods to those in LocalDate
Links
ZoneDateTime
Duration
Time measurement
A great way of measuring how long a method call takes.
Last updated