Class DateUtils
- java.lang.Object
-
- org.craftercms.studio.impl.v2.utils.DateUtils
-
public abstract class DateUtils extends Object
Utility methods for handling dates- Since:
- 4.0.0
- Author:
- joseross
-
-
Field Summary
Fields Modifier and Type Field Description static DateTimeFormatter
ISO_FORMATTER
-
Constructor Summary
Constructors Constructor Description DateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
formatCurrentTime(String pattern)
Applies the given pattern to format the current time in UTCstatic String
formatCurrentTime(DateTimeFormatter formatter)
Applies the given formatter to the current time in UTCstatic String
formatDate(ZonedDateTime dateTime, String patter)
Formats a date using any patternstatic String
formatDate(ZonedDateTime dateTime, DateTimeFormatter formatter)
Formats a date using a formatterstatic String
formatDateIso(ZonedDateTime dateTime)
static ZonedDateTime
getCurrentTime()
Returns the current time in UTCstatic String
getCurrentTimeIso()
Returns the current time in UTC formatted using the ISO standardstatic ZonedDateTime
parseDate(String value, DateTimeFormatter formatter)
Parses a date using a formatterstatic ZonedDateTime
parseDateIso(String value)
Parses a date using the UTC formatter
-
-
-
Field Detail
-
ISO_FORMATTER
public static final DateTimeFormatter ISO_FORMATTER
-
-
Method Detail
-
getCurrentTime
public static ZonedDateTime getCurrentTime()
Returns the current time in UTC
-
formatCurrentTime
public static String formatCurrentTime(DateTimeFormatter formatter)
Applies the given formatter to the current time in UTC
-
getCurrentTimeIso
public static String getCurrentTimeIso()
Returns the current time in UTC formatted using the ISO standard
-
formatCurrentTime
public static String formatCurrentTime(String pattern)
Applies the given pattern to format the current time in UTC
-
formatDate
public static String formatDate(ZonedDateTime dateTime, String patter)
Formats a date using any pattern
-
formatDateIso
public static String formatDateIso(ZonedDateTime dateTime)
-
formatDate
public static String formatDate(ZonedDateTime dateTime, DateTimeFormatter formatter)
Formats a date using a formatter
-
parseDate
public static ZonedDateTime parseDate(String value, DateTimeFormatter formatter)
Parses a date using a formatter
-
parseDateIso
public static ZonedDateTime parseDateIso(String value)
Parses a date using the UTC formatter
-
-