The java.time.LocalDateTime class is an immutable date-time class that represents a date-time with the default format as yyyy-MM-dd-HH-mm-ss.zzz. This class does not store or represent a time-zone. Instead, it is a description of the date, as used for birthdays, combined with the local time as seen on a wall clock. It cannot represent an instant on the time-line without additional information such as an offset or time-zone.
Java LocalDateTime class methods
String format(DateTimeFormatter formatter)
It is used to format this date-time using the specified formatter.
int get(TemporalField field)
It is used to get the value of the specified field from this date-time as an int.
LocalDateTime minusDays(long days)
It is used to return a copy of this LocalDateTime with the specified number of days subtracted.
static LocalDateTime now()
It is used to obtain the current date-time from the system clock in the default time-zone.
Before Formatting: 2018-04-15T18:45:45.318
After Formatting: 15-04-2018 18:45:45
Before Formatting: 2017-11-15T22:46
After Formatting: 15-11-2017 22:46:00
Before Formatting: 2018-08-31T22:46
After Formatting: 31-08-2018 22:46:00