Package org.omegat.util
Class TMXDateParser
java.lang.Object
org.omegat.util.TMXDateParser
Date parser for the 'basic' ISO 8601 format that is advised for TMX dates.
There are many variations of the ISO8601 standard (the good thing about
standards is that there are so many to choose from :( ) The
TMX specification refers to
the 'extended'
format, but although referring to this standard, it recommends the
'basic' format: YYYYMMDDThhmmssZ. Since all translation tools conform to this
format, this parser only parses this variant of the 'basic' format.
DateFormat is not thread-safe, so this class must be instantiated.
-
Constructor Summary
ConstructorsConstructorDescriptionWraps a DateFormat with format YYYYMMDDThhmmssZ able to display a date in UTC time. -
Method Summary
Modifier and TypeMethodDescriptiongetTMXDate(long date) Returns the string representation of the date according to the preferred TMX date format 'YYYYMMDDThhmmssZ'getTMXDate(Date date) Returns the string representation of the date according to the preferred TMX date format 'YYYYMMDDThhmmssZ'Parse the given string as TMX date format (ISO 8601 compatible 'YYYYMMDDThhmmssZ') and returns the Date
-
Constructor Details
-
TMXDateParser
public TMXDateParser()Wraps a DateFormat with format YYYYMMDDThhmmssZ able to display a date in UTC time.
-
-
Method Details
-
parse
Parse the given string as TMX date format (ISO 8601 compatible 'YYYYMMDDThhmmssZ') and returns the Date- Parameters:
tmxDate- A date representation in YYYYMMDDThhmmssZ format- Returns:
- a Date instance
- Throws:
ParseException- if the date is null or not valid
-
getTMXDate
Returns the string representation of the date according to the preferred TMX date format 'YYYYMMDDThhmmssZ'- Parameters:
date- a Date instance- Returns:
- a string representing the date in the ISO 8601 compatible format 'YYYYMMDDThhmmssZ'
-
getTMXDate
Returns the string representation of the date according to the preferred TMX date format 'YYYYMMDDThhmmssZ'- Parameters:
date- unix timestamp (ms since 1970)- Returns:
- a string representing the date in the ISO 8601 compatible format 'YYYYMMDDThhmmssZ'
-