Package com.ethlo.time
Interface W3cDateTimeUtil
-
- All Known Implementing Classes:
EthloITU
public interface W3cDateTimeUtilThis class deals with the formats mentioned in W3C - NOTE-datetime: https://www.w3.org/TR/NOTE-datetime- Year:
YYYY (eg 1997) -
Year and month:
YYYY-MM (eg 1997-07) -
Complete date:
YYYY-MM-DD (eg 1997-07-16) -
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00) -
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00) -
Complete date plus hours, minutes, seconds and a decimal fraction of a second
YYYY-MM-DDThh:mm:ss.STZD (eg 1997-07-16T19:20:30.45+01:00)
where:
- YYYY = four-digit year
- MM = two-digit month (01=January, etc.)
- DD = two-digit day of month (01 through 31)
- hh = two digits of hour (00 through 23) (am/pm NOT allowed)
- mm = two digits of minute (00 through 59)
- ss = two digits of second (00 through 59)
- S = one or more digits representing a decimal fraction of a second
- TZD = time zone designator (Z or +hh:mm or -hh:mm)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Stringformat(OffsetDateTime parse, Field year)StringformatUtc(OffsetDateTime date, Field lastIncluded, int fractionDigits)Format the date/date-time in UTC formatTemporalparseLenient(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
-
formatUtc
String formatUtc(OffsetDateTime date, Field lastIncluded, int fractionDigits)
Format the date/date-time in UTC format- Parameters:
date- The date to formatlastIncluded- The last included fieldfractionDigits- The number of fraction digits, if applicable- Returns:
- the formatted date/date-time
-
parseLenient
<T extends Temporal> T parseLenient(String s, Class<T> type)
Parse the format with an expected type, i.e sub-class ofTemporal- Type Parameters:
T- The expected type- Parameters:
s- The date/date-time to parsetype- The type you expect- Returns:
- The parsed date/date-time
-
parseLenient
Temporal parseLenient(String s)
Parse the format and return it as a fitting sub-class ofTemporal- Parameters:
s- The date/date-time to parse- Returns:
- The parsed date/date-time
-
format
String format(OffsetDateTime parse, Field year)
-
-