Class ConcurrentDateFormat
java.lang.Object
org.apache.tomcat.util.http.ConcurrentDateFormat
A thread safe wrapper around
SimpleDateFormat that does not make use of ThreadLocal and - broadly - only
creates enough SimpleDateFormat objects to satisfy the concurrency requirements.-
Constructor Summary
ConstructorsConstructorDescriptionConcurrentDateFormat(String format, Locale locale, TimeZone timezone) Creates a thread-safe date formatter with the specified format, locale, and timezone. -
Method Summary
Modifier and TypeMethodDescriptionFormats the given date into a string using the configured format pattern.Parses the given string into a date using the configured format pattern.Parses the given string into a date using the configured format pattern.
-
Constructor Details
-
ConcurrentDateFormat
-
-
Method Details
-
format
-
parse
Parses the given string into a date using the configured format pattern.- Parameters:
source- the string to parse- Returns:
- the parsed date
- Throws:
ParseException- if the string cannot be parsed
-
parse
Parses the given string into a date using the configured format pattern. A two-digit year is resolved to the 100 year period that starts at the given date.- Parameters:
source- the string to parsetwoDigitYearStart- the start of the 100 year period that a two-digit year is resolved to- Returns:
- the parsed date
- Throws:
ParseException- if the string cannot be parsed- Since:
- 12.0.x
-