
set by a custom TemporalAdjuster that adjusts to the next even second add/subtract 1 year to the parsed LocalDate and returns a new instanceĭt.plus(3, ChronoUnit.DECADES) // 'T23:55:42.123'ĭt.minus(3, ChronoUnit.DECADES) // 'T23:55:42.123' any other date or time-based ChronoField can be passed to `get` Adding to and subtracting from a LocalDateTime instance var dt = LocalDateTime.parse("T23:55:42.123")

get other date-based fields like the aligned week of yearĭt.get(ChronoField.ALIGNED_WEEK_OF_YEAR) // 9ĭt.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR) // 8ĭt.get(ChronoField.SECOND_OF_DAY) // 86142ĭt.get(ChronoField.MILLI_OF_SECOND) // 123 obtain the date and time components of the LocalDateTimeĭt.range(ChronoField.DAY_OF_MONTH) // ValueRange(1 - 29)ĭt.range(ChronoField.DAY_OF_YEAR) // ValueRange(1 - 366)
JODA TIME MINUS MINUTES ISO
LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC) // current local UTC date-time Get values from LocalDateTime var dt = LocalDateTime.parse("T23:55:42.123") ĭt.toString() // 'T23:55:42.123' ISO 8601 formatĭt.toLocalDate().isLeapYear() // true 2016 is a leap year LocalDateTime.ofInstant(Instant.now()) // current local date-time LocalDateTime.ofEpochSecond(0, ZoneOffset.UTC) // 'T00:00' obtain an instance of LocalDateTime from epoch seconds and a ZoneOffset obtain an instance of LocalDateTime from year, month, dayOfMonth, hour, minute, second and nanosecond values obtain an instance of LocalDateTime from an ISO 8601 formatted text string


obtain the current date and time in the UTC time zone Create a LocalDateTime instance // obtain the current date and time in the system default time zone, e.g. A LocalDateTime represents a date-time with no time zone in the ISO-8601 calendar system, such as 'T10:15:30'.
