Java LocalDateTime classJava LocalDateTime class is an immutable date-time object that represents a date-time, with the default format as yyyy-MM-dd-HH-mm-ss.zzz. It inherits object class and implements the ChronoLocalDateTime interface. Java LocalDateTime class declarationLet's see the declaration of java.time.LocalDateTime class. Methods of Java LocalDateTime
Java LocalDateTime ExampleTest it NowOutput: Before Formatting: 2017-01-13T17:09:42.411 After Formatting: 13-01-2017 17:09:42 Java LocalDateTime Example: now()Test it NowOutput: 14-01-2017 11:42:32 Java LocalDateTime Example: get()Test it NowOutput: 1 44 13 15 956 Java LocalDateTime Example: minusDays()Test it NowOutput: Before Formatting: 2016-10-06T10:34 After Formatting: 06-10-2016 10:34 Java LocalDateTime Example: plusDays()Test it NowOutput: Before Formatting: 2017-05-14T10:34 After Formatting: 14-05-2017 10:34
Next TopicJava MonthDay
|