Package com.ethlo.time
Class EthloITU
- java.lang.Object
-
- com.ethlo.time.AbstractRfc3339
-
- com.ethlo.time.EthloITU
-
- All Implemented Interfaces:
Rfc3339,Rfc3339Formatter,Rfc3339Parser,W3cDateTimeUtil
public class EthloITU extends AbstractRfc3339 implements W3cDateTimeUtil
-
-
Field Summary
-
Fields inherited from class com.ethlo.time.AbstractRfc3339
MAX_FRACTION_DIGITS
-
-
Constructor Summary
Constructors Constructor Description EthloITU()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends Temporal>
TemporaldoParseLenient(String s, Class<T> type)Stringformat(OffsetDateTime date, Field lastIncluded)Stringformat(Date date, String timezone)Format a date in the given time-zoneStringformat(Date date, String timezone, int fractionDigits)Format the date as a date-time String with specified resolution and time-zone offset, for example 1999-12-31T16:48:36[.123456789]-05:00StringformatUtc(OffsetDateTime date)Format theDateas a UTC formatted date-time stringStringformatUtc(OffsetDateTime date, int fractionDigits)Format the date as a date-time String with specified resolution, aka 1999-12-31T16:48:36[.123456789]ZStringformatUtc(OffsetDateTime date, Field lastIncluded, int fractionDigits)Format the date/date-time in UTC formatStringformatUtc(Date date)StringformatUtcMicro(OffsetDateTime date)Format the date as a date-time String with microsecond resolution, aka 1999-12-31T16:48:36.123456ZStringformatUtcMilli(OffsetDateTime date)Format the date as a date-time String with millisecond resolution, for example 1999-12-31T16:48:36.123ZStringformatUtcMilli(Date date)StringformatUtcNano(OffsetDateTime date)Format the date as a date-time String with nanosecond resolution, aka 1999-12-31T16:48:36.123456789ZbooleanisValid(String dateTime)Check whether the string is a valid date-time according to RFC-3339OffsetDateTimeparseDateTime(String text)Parse the date-time and return it as aOffsetDateTime.TemporalparseLenient(String s)Parse the format and return it as a fitting sub-class ofTemporal<T extends Temporal>
TparseLenient(String s, Class<T> type)Parse the format with an expected type, i.e sub-class ofTemporal
-
-
-
Method Detail
-
parseDateTime
public OffsetDateTime parseDateTime(String text)
Description copied from interface:Rfc3339ParserParse the date-time and return it as aOffsetDateTime.- Specified by:
parseDateTimein interfaceRfc3339Parser- Parameters:
text- The date-time string to parse- Returns:
- The
OffsetDateTimeas parsed from the input
-
formatUtc
public String formatUtc(OffsetDateTime date, int fractionDigits)
Description copied from interface:Rfc3339FormatterFormat the date as a date-time String with specified resolution, aka 1999-12-31T16:48:36[.123456789]Z- Specified by:
formatUtcin interfaceRfc3339Formatter- Parameters:
date- The date to formatfractionDigits- The number of fractional digits in the second- Returns:
- the formatted string
-
format
public String format(OffsetDateTime date, Field lastIncluded)
- Specified by:
formatin interfaceW3cDateTimeUtil
-
formatUtc
public String formatUtc(OffsetDateTime date, Field lastIncluded, int fractionDigits)
Description copied from interface:W3cDateTimeUtilFormat the date/date-time in UTC format- Specified by:
formatUtcin interfaceW3cDateTimeUtil- Parameters:
date- The date to formatlastIncluded- The last included fieldfractionDigits- The number of fraction digits, if applicable- Returns:
- the formatted date/date-time
-
formatUtc
public String formatUtc(Date date)
Description copied from interface:Rfc3339Formatter- Specified by:
formatUtcin interfaceRfc3339Formatter- Parameters:
date- The date to format- Returns:
- The formatted string
-
format
public String format(Date date, String timezone)
Description copied from interface:Rfc3339FormatterFormat a date in the given time-zone- Specified by:
formatin interfaceRfc3339Formatter- Parameters:
date- The date to formattimezone- The time-zone- Returns:
- the formatted string
-
isValid
public boolean isValid(String dateTime)
Description copied from interface:Rfc3339ParserCheck whether the string is a valid date-time according to RFC-3339- Specified by:
isValidin interfaceRfc3339Parser- Parameters:
dateTime- The date-time to validate- Returns:
- True if valid date-time or null, false otherwise
-
formatUtcMilli
public String formatUtcMilli(OffsetDateTime date)
Description copied from interface:Rfc3339FormatterFormat the date as a date-time String with millisecond resolution, for example 1999-12-31T16:48:36.123Z- Specified by:
formatUtcMilliin interfaceRfc3339Formatter- Parameters:
date- The date to format- Returns:
- the formatted string
-
formatUtcMicro
public String formatUtcMicro(OffsetDateTime date)
Description copied from interface:Rfc3339FormatterFormat the date as a date-time String with microsecond resolution, aka 1999-12-31T16:48:36.123456Z- Specified by:
formatUtcMicroin interfaceRfc3339Formatter- Parameters:
date- The date to format- Returns:
- the formatted string
-
formatUtcNano
public String formatUtcNano(OffsetDateTime date)
Description copied from interface:Rfc3339FormatterFormat the date as a date-time String with nanosecond resolution, aka 1999-12-31T16:48:36.123456789Z- Specified by:
formatUtcNanoin interfaceRfc3339Formatter- Parameters:
date- The date to format- Returns:
- the formatted string
-
formatUtc
public String formatUtc(OffsetDateTime date)
Description copied from interface:Rfc3339FormatterFormat theDateas a UTC formatted date-time string- Specified by:
formatUtcin interfaceRfc3339Formatter- Parameters:
date- The date to format- Returns:
- the formatted string
-
formatUtcMilli
public String formatUtcMilli(Date date)
Description copied from interface:Rfc3339Formatter- Specified by:
formatUtcMilliin interfaceRfc3339Formatter- Parameters:
date- The date to format- Returns:
- The formatted string
-
format
public String format(Date date, String timezone, int fractionDigits)
Description copied from interface:Rfc3339FormatterFormat the date as a date-time String with specified resolution and time-zone offset, for example 1999-12-31T16:48:36[.123456789]-05:00- Specified by:
formatin interfaceRfc3339Formatter- Parameters:
date- The date to formattimezone- The time-zonefractionDigits- The number of fraction digits- Returns:
- the formatted string
-
parseLenient
public Temporal parseLenient(String s)
Description copied from interface:W3cDateTimeUtilParse the format and return it as a fitting sub-class ofTemporal- Specified by:
parseLenientin interfaceW3cDateTimeUtil- Parameters:
s- The date/date-time to parse- Returns:
- The parsed date/date-time
-
parseLenient
public <T extends Temporal> T parseLenient(String s, Class<T> type)
Description copied from interface:W3cDateTimeUtilParse the format with an expected type, i.e sub-class ofTemporal- Specified by:
parseLenientin interfaceW3cDateTimeUtil- Type Parameters:
T- The expected type- Parameters:
s- The date/date-time to parsetype- The type you expect- Returns:
- The parsed date/date-time
-
-