Package io.vertigo.core.lang.json
Class UTCDateUtil
java.lang.Object
io.vertigo.core.lang.json.UTCDateUtil
Utility class for handling UTC date conversions in JSON processing.
Supports multiple date formats:
- ISO8601 (primary)
- RFC 822/1123
- RFC 850/1036
Handles both Date and Instant types with timezone awareness.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatInstantISO8601(Instant instant) Formats Instant to ISO8601 UTC string.static StringformatISO8601(Date date) Formats date to ISO8601 UTC string.static DateParses UTC date string to Date.static InstantparseInstant(String inputDate) Parses date string to Instant.
-
Method Details
-
formatISO8601
Formats date to ISO8601 UTC string. Preserves date truncation information.- Parameters:
date- Date to format- Returns:
- UTC date string in ISO8601 format
-
formatInstantISO8601
Formats Instant to ISO8601 UTC string.- Parameters:
instant- Instant to format- Returns:
- UTC string in ISO8601 format
-
parse
Parses UTC date string to Date. Attempts multiple format patterns in order.- Parameters:
inputDate- UTC date string- Returns:
- Parsed Date object
- Throws:
com.google.gson.JsonParseException- if date format is not supported
-
parseInstant
Parses date string to Instant. Attempts multiple format patterns in order.- Parameters:
inputDate- Date string to parse- Returns:
- Parsed Instant object
- Throws:
com.google.gson.JsonParseException- if date format is not supported
-