public final class DateTimeUtil extends Object
Modifier and Type | Method and Description |
---|---|
static String |
jodaFormat(ZonedDateTime dateTime)
Returns the ISO8601 string of a given date-time instance with timezone information, trying to be as closed as possible
to what the JODA date-time library would return.
|
static ZonedDateTime |
jodaParse(String iso8601)
Creates a
ZonedDateTime instance based on the given pattern in ISO 8601 format, compatible with the Joda date-time
library. |
static LocalDateTime |
localDateTimeUTC(long millis)
Creates a new UTC
LocalDateTime instance based on the given millis value |
public static final ZoneId UTC
public static ZonedDateTime jodaParse(String iso8601) throws DateTimeParseException
ZonedDateTime
instance based on the given pattern in ISO 8601 format, compatible with the Joda date-time
library.
Note that there is no direct correspondence between the JODA-style dates and the new JDK 8 date, especially when it comes to handling milliseconds.
iso8601
- a String
representing a date and/or time pattern, may not be nullZonedDateTime
instance, never null
DateTimeParseException
- if the given pattern cannot be parsedpublic static String jodaFormat(ZonedDateTime dateTime)
dateTime
- a ZonedDateTime
instance, may not be nullString
representation of the date instance according to the ISO8601 standardpublic static LocalDateTime localDateTimeUTC(long millis)
LocalDateTime
instance based on the given millis valuemillis
- a positive amount of millisLocalDateTime
instance.Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.