Package com.attivio.util
Class AttivioDateFormat
- java.lang.Object
-
- com.attivio.util.AttivioDateFormat
-
public final class AttivioDateFormat extends java.lang.Object
This class provides functions for parsing and formatting dates in a format used by the Attivio Engine.The
parse(...)
methods will parse dates in the following formats:
- yyyy
- yyyy-MM
- yyyy-MM-dd
- yyyy-MM-dd HH
- yyyy-MM-dd'T'HH
- yyyy-MM-dd HH:mm
- yyyy-MM-dd'T'HH:mm
- yyyy-MM-dd HH:mm:ss
- yyyy-MM-dd'T'HH:mm:ss
- yyyy-MM-dd HH:mm:ss.SSS
- yyyy-MM-dd'T'HH:mm:ss.SSS
NOTE: the parse methods will also parse the string "NOW" as a new Date with the current time.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
format(java.util.Date date)
Format a date in "yyyy-MM-dd'T'HH:mm:ss" format.static java.lang.String
formatMilliseconds(java.util.Date date)
Format a date in "yyyy-MM-dd'T'HH:mm:ss.SSS" format.static java.lang.String
formatMillisecondsOptional(java.util.Date date)
Format a date in "yyyy-MM-dd'T'HH:mm:ss[.SSS]" format, with milliseconds only if specified.static java.util.Date
parse(java.lang.CharSequence source)
Parses an Attivio Date value specified in UTC.static java.util.Date
parse(java.lang.CharSequence source, java.util.TimeZone timeZone)
Parses an Attivio Date value specified astimeZone
.static java.util.Date
parse(java.lang.Object value)
static java.util.Date
parse(java.lang.String source)
Parses an Attivio Date value specified in UTC.static java.util.Date
parse(java.lang.String source, java.util.TimeZone timeZone)
Parses an Attivio Date value specified astimeZone
.static long
parseMillis(java.lang.CharSequence source, java.util.TimeZone defaultTimeZone)
Parses an Attivio Date value specified astimeZone
into milliseconds since epoch.static boolean
supportsFormat(java.lang.String format)
Returnstrue
if the parse() method supports the specified dateformat
.
-
-
-
Method Detail
-
supportsFormat
public static boolean supportsFormat(java.lang.String format)
Returnstrue
if the parse() method supports the specified dateformat
.
-
format
public static java.lang.String format(java.util.Date date)
Format a date in "yyyy-MM-dd'T'HH:mm:ss" format.
-
formatMilliseconds
public static java.lang.String formatMilliseconds(java.util.Date date)
Format a date in "yyyy-MM-dd'T'HH:mm:ss.SSS" format.
-
formatMillisecondsOptional
public static java.lang.String formatMillisecondsOptional(java.util.Date date)
Format a date in "yyyy-MM-dd'T'HH:mm:ss[.SSS]" format, with milliseconds only if specified.
-
parse
public static java.util.Date parse(java.lang.Object value)
-
parse
public static java.util.Date parse(java.lang.String source)
Parses an Attivio Date value specified in UTC.
-
parse
public static java.util.Date parse(java.lang.CharSequence source)
Parses an Attivio Date value specified in UTC.
-
parse
public static java.util.Date parse(java.lang.String source, java.util.TimeZone timeZone)
Parses an Attivio Date value specified astimeZone
.
-
parse
public static java.util.Date parse(java.lang.CharSequence source, java.util.TimeZone timeZone)
Parses an Attivio Date value specified astimeZone
.
-
parseMillis
public static long parseMillis(java.lang.CharSequence source, java.util.TimeZone defaultTimeZone)
Parses an Attivio Date value specified astimeZone
into milliseconds since epoch.
-
-