Package org.omegat.util
Class TMXDateParser
- java.lang.Object
-
- org.omegat.util.TMXDateParser
-
public class TMXDateParser extends java.lang.Object
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
Constructors Constructor Description TMXDateParser()
Wraps a DateFormat with format YYYYMMDDThhmmssZ able to display a date in UTC time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getTMXDate(long date)
Returns the string representation of the date according to the preferred TMX date format 'YYYYMMDDThhmmssZ'java.lang.String
getTMXDate(java.util.Date date)
Returns the string representation of the date according to the preferred TMX date format 'YYYYMMDDThhmmssZ'java.util.Date
parse(java.lang.String tmxDate)
Parse the given string as TMX date format (ISO 8601 compatible 'YYYYMMDDThhmmssZ') and returns the Date
-
-
-
Method Detail
-
parse
public java.util.Date parse(java.lang.String tmxDate) throws java.text.ParseException
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:
java.text.ParseException
- if the date is null or not valid
-
getTMXDate
public java.lang.String getTMXDate(java.util.Date date)
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
public java.lang.String getTMXDate(long date)
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'
-
-