Package com.landawn.abacus.util
Class ISO8601Util
java.lang.Object
com.landawn.abacus.util.ISO8601Util
Copyright (c) 2017, Jackson Authors/Contributers.
Utilities methods for manipulating dates in iso8601 format. This is much much faster and GC friendly than using SimpleDateFormat so
highly suitable if you (un)serialize lots of date objects.
Supported parse format: [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh[:]mm]]
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Format a date into 'yyyy-MM-ddThh:mm:ssZ' (default timezone, no milliseconds precision).static String
Format a date into 'yyyy-MM-ddThh:mm:ss[.sss]Z' (GMT timezone)static String
Deprecated.static String
Format date into yyyy-MM-ddThh:mm:ss[.sss][Z|[+-]hh:mm]static Date
static Date
parse
(String date, ParsePosition pos) Parse a date from ISO-8601 formatted string.
-
Method Details
-
format
Format a date into 'yyyy-MM-ddThh:mm:ssZ' (default timezone, no milliseconds precision).- Parameters:
date
- the date to format- Returns:
-
format
Format a date into 'yyyy-MM-ddThh:mm:ss[.sss]Z' (GMT timezone)- Parameters:
date
- the date to formatmillis
- true to include millis precision otherwise false- Returns:
-
format
Deprecated.- Parameters:
date
-millis
-tz
-- Returns:
-
format
Format date into yyyy-MM-ddThh:mm:ss[.sss][Z|[+-]hh:mm]- Parameters:
date
- the date to formatmillis
- true to include millis precision otherwise falsetz
- timezone to use for the formatting (UTC will produce 'Z')loc
-- Returns:
- Since:
- 2.9
-
parse
- Parameters:
date
-- Returns:
-
parse
Parse a date from ISO-8601 formatted string. It expects a format [yyyy-MM-dd|yyyyMMdd][T(hh:mm[:ss[.sss]]|hhmm[ss[.sss]])]?[Z|[+-]hh:mm]]- Parameters:
date
- ISO string to parse in the appropriate format.pos
- The position to start parsing from, updated to where parsing stopped.- Returns:
-