Package ca.uhn.fhir.util
Class DateUtils
java.lang.Object
ca.uhn.fhir.util.DateUtils
A utility class for parsing and formatting HTTP dates as used in cookies and
other headers. This class handles dates as defined by RFC 2616 section
3.3.1 as well as some other common non-standard formats.
This class is basically intended to be a high-performance workaround for the fact that Java SimpleDateFormat is kind of expensive to create and yet isn't thread safe.
This class was adapted from the class with the same name from the Jetty project, licensed under the terms of the Apache Software License 2.0.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic TimeZoneGMT TimeZonestatic StringDate format pattern used to parse HTTP date headers in ANSI Casctime()format.static StringDate format pattern used to parse HTTP date headers in RFC 1036 format.static StringDate format pattern used to parse HTTP date headers in RFC 1123 format. -
Method Summary
Modifier and TypeMethodDescriptionstatic intconvertDateToDayInteger(Date theDateValue)static StringconvertDateToIso8601String(Date theDateValue)static StringformatDate(Date date)Formats the given date according to the RFC 1123 pattern.static DategetHighestInstantFromDate(Date theDateValue)static DategetLowestInstantFromDate(Date theDateValue)static <T> Tstatic DateParses a date value.
-
Field Details
-
GMT
GMT TimeZone -
PATTERN_RFC1123
Date format pattern used to parse HTTP date headers in RFC 1123 format.- See Also:
- Constant Field Values
-
PATTERN_RFC1036
Date format pattern used to parse HTTP date headers in RFC 1036 format.- See Also:
- Constant Field Values
-
PATTERN_ASCTIME
Date format pattern used to parse HTTP date headers in ANSI Casctime()format.- See Also:
- Constant Field Values
-
-
Method Details
-
parseDate
Parses a date value. The formats used for parsing the date value are retrieved from the default http params.- Parameters:
theDateValue- the date value to parse- Returns:
- the parsed date or null if input could not be parsed
-
getHighestInstantFromDate
-
getLowestInstantFromDate
-
convertDateToDayInteger
-
convertDateToIso8601String
-
formatDate
Formats the given date according to the RFC 1123 pattern.- Parameters:
date- The date to format.- Returns:
- An RFC 1123 formatted date string.
- See Also:
PATTERN_RFC1123
-
notNull
-