Package org.nuxeo.common.utils
Class DateUtils
- java.lang.Object
-
- org.nuxeo.common.utils.DateUtils
-
public class DateUtils extends Object
Java 8 time utilities.- Since:
- 11.1
-
-
Field Summary
Fields Modifier and Type Field Description static DateTimeFormatter[]
formatters
static DateTimeFormatter
ISO_DATE_ONLY
static DateTimeFormatter
ISO_ROBUST_DATE_TIME
static String
ISODATETIME_GENERIC_PATTERN
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
formatISODateTime(ZonedDateTime zdt)
static String
formatISODateTime(ZonedDateTime zdt, boolean dateOnly)
static String
formatISODateTime(Calendar calendar)
static String
formatISODateTime(Date date)
static ZonedDateTime
nowIfNull(ZonedDateTime zdt)
static Calendar
nowIfNull(Calendar calendar)
static Date
nowIfNull(Date date)
static ZonedDateTime
parse(String string, DateTimeFormatter... formatters)
static ZonedDateTime
parseISODateTime(String string)
static DateTimeFormatter
robustOfPattern(String pattern)
static Calendar
toCalendar(Instant instant)
static Date
toDate(ZonedDateTime zdt)
static Instant
toInstant(Calendar calendar)
static ZonedDateTime
toZonedDateTime(Calendar calendar)
static ZonedDateTime
toZonedDateTime(Date date)
-
-
-
Field Detail
-
ISODATETIME_GENERIC_PATTERN
public static final String ISODATETIME_GENERIC_PATTERN
- See Also:
- Constant Field Values
-
ISO_ROBUST_DATE_TIME
public static final DateTimeFormatter ISO_ROBUST_DATE_TIME
-
formatters
public static final DateTimeFormatter[] formatters
-
ISO_DATE_ONLY
public static final DateTimeFormatter ISO_DATE_ONLY
-
-
Method Detail
-
formatISODateTime
public static String formatISODateTime(ZonedDateTime zdt)
-
formatISODateTime
public static String formatISODateTime(ZonedDateTime zdt, boolean dateOnly)
-
nowIfNull
public static ZonedDateTime nowIfNull(ZonedDateTime zdt)
-
parseISODateTime
public static ZonedDateTime parseISODateTime(String string)
-
parse
public static ZonedDateTime parse(String string, DateTimeFormatter... formatters)
-
robustOfPattern
public static final DateTimeFormatter robustOfPattern(String pattern)
-
toDate
public static Date toDate(ZonedDateTime zdt)
-
toZonedDateTime
public static ZonedDateTime toZonedDateTime(Calendar calendar)
-
toZonedDateTime
public static ZonedDateTime toZonedDateTime(Date date)
-
-