Package org.apache.tika.utils
Class DateUtils
- java.lang.Object
- 
- org.apache.tika.utils.DateUtils
 
- 
 public class DateUtils extends Object Date related utility methods and constants
- 
- 
Field SummaryFields Modifier and Type Field Description static TimeZoneMIDDAYCustom time zone used to interpret date values without a time component in a way that most likely falls within the same day regardless of in which time zone it is later interpreted.static TimeZoneUTCThe UTC time zone.
 - 
Constructor SummaryConstructors Constructor Description DateUtils()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringformatDate(Calendar date)Returns a ISO 8601 representation of the given date in UTC, truncated to the seconds unit.static StringformatDate(Date date)Returns a ISO 8601 representation of the given date in UTC, truncated to the seconds unit.static StringformatDateUnknownTimezone(Date date)Returns a ISO 8601 representation of the given date in UTC, truncated to the seconds unit.DatetryToParse(String dateString)Tries to parse the date string; returns null if no parse was possible.
 
- 
- 
- 
Field Detail- 
UTCpublic static final TimeZone UTC The UTC time zone. Not sure ifTimeZone.getTimeZone(String)understands "UTC" in all environments, but it'll fall back to GMT in such cases, which is in practice equivalent to UTC.
 - 
MIDDAYpublic static final TimeZone MIDDAY Custom time zone used to interpret date values without a time component in a way that most likely falls within the same day regardless of in which time zone it is later interpreted. For example, the "2012-02-17" date would map to "2012-02-17T12:00:00Z" (instead of the default "2012-02-17T00:00:00Z"), which would still map to "2012-02-17" if interpreted in say Pacific time (while the default mapping would result in "2012-02-16" for UTC-8).
 
- 
 - 
Method Detail- 
formatDatepublic static String formatDate(Date date) Returns a ISO 8601 representation of the given date in UTC, truncated to the seconds unit. This method is thread safe and non-blocking.- Parameters:
- date- given date
- Returns:
- ISO 8601 date string in UTC, truncated to the seconds unit
- See Also:
- TIKA-495
 
 - 
formatDatepublic static String formatDate(Calendar date) Returns a ISO 8601 representation of the given date in UTC, truncated to the seconds unit. This method is thread safe and non-blocking.- Parameters:
- date- given Calendar
- Returns:
- ISO 8601 date string in UTC, truncated to the seconds unit
- See Also:
- TIKA-495
 
 - 
formatDateUnknownTimezonepublic static String formatDateUnknownTimezone(Date date) Returns a ISO 8601 representation of the given date in UTC, truncated to the seconds unit. This method is thread safe and non-blocking.- Parameters:
- date- given date
- Returns:
- ISO 8601 date string in UTC, truncated to the seconds unit
- See Also:
- TIKA-495
 
 
- 
 
-