Modifier and Type | Field and Description |
---|---|
static DateTimeFormatter |
DEFAULT_FORMAT |
static DateTimeFormatter |
ISO_FORMAT |
static DateTimeFormatter |
MINUTE_FORMAT |
static DateTimeFormatter |
SLUG_FORMAT |
static DateTimeFormatter |
SQL_FORMAT |
Constructor and Description |
---|
DateUtils() |
Modifier and Type | Method and Description |
---|---|
static ZoneId |
currentUserTimeZoneId() |
static int |
currentUserUtcOffsetMinutes() |
static String |
formatLocalDate(Object dt) |
static String |
formatLocalDate(Object dt,
String formatPattern) |
static String |
formatLocalDateFromJDate(Date date) |
static String |
formatLocalDateFromJDate(Date date,
String formatPattern) |
static String |
formatLocalDateFromLong(long epochMillis) |
static String |
formatLocalDateFromLong(Long epochMillis) |
static String |
formatLocalDateFromLong(long epochMillis,
String formatPattern) |
static String |
formatLocalDateFromLong(Long epochMillis,
String formatPattern) |
static String |
formatLocalDateFromString(String dateStamp,
String formatPattern) |
static String |
formatLocalDateFromZonedDate(ZonedDateTime date) |
static String |
formatLocalDateFromZonedDate(ZonedDateTime date,
String formatPattern)
Formats a ZonedDateTime into a string with the given DateTimeFormatter pattern
|
static String |
formatNow(String format)
Format the current time using a date format string
|
static ZonedDateTime |
localNow()
Gets the current time in the local time zone.
|
static long |
mils()
Milliseconds since the epoch
|
static ZonedDateTime |
milsToDateTime(long mils)
Converts milliseconds since the unix epoch to a ZonedDateTime in UTC
|
static String |
slugifyDate(Long epochMillis)
Turns the date into a format that has no spaces, colons, or any other invalid characters invalid for a file name
The actual format used is: YYYY-MM-dd-HHmm-ssSS
|
static String |
slugifyDate(ZonedDateTime date)
Turns the date into a format that has no spaces, colons, or any other invalid characters invalid for a file name
The actual format used is: YYYY-MM-dd-HHmm-ssSS
|
static ZonedDateTime |
utcNow()
Gets the current time in UTC
|
public static final DateTimeFormatter DEFAULT_FORMAT
public static final DateTimeFormatter SLUG_FORMAT
public static final DateTimeFormatter ISO_FORMAT
public static final DateTimeFormatter SQL_FORMAT
public static final DateTimeFormatter MINUTE_FORMAT
public DateUtils()
public static ZonedDateTime utcNow()
public static long mils()
public static ZonedDateTime milsToDateTime(long mils)
mils
- public static String formatLocalDateFromZonedDate(ZonedDateTime date, String formatPattern)
date
- formatPattern
- public static String slugifyDate(Long epochMillis)
epochMillis
- public static String slugifyDate(ZonedDateTime date)
date
- public static ZonedDateTime localNow()
public static ZoneId currentUserTimeZoneId()
public static int currentUserUtcOffsetMinutes()
public static String formatNow(String format)
format
- public static String formatLocalDate(Object dt, String formatPattern)
public static String formatLocalDate(Object dt)
public static String formatLocalDateFromJDate(Date date)
public static String formatLocalDateFromJDate(Date date, String formatPattern)
public static String formatLocalDateFromString(String dateStamp, String formatPattern)
public static String formatLocalDateFromLong(long epochMillis)
public static String formatLocalDateFromLong(long epochMillis, String formatPattern)
public static String formatLocalDateFromLong(Long epochMillis)
public static String formatLocalDateFromLong(Long epochMillis, String formatPattern)
public static String formatLocalDateFromZonedDate(ZonedDateTime date)
Copyright © 2016. All rights reserved.