public class TMXDateParser
extends java.lang.Object
DateFormat is not thread-safe, so this class must be instantiated.
Constructor and Description |
---|
TMXDateParser()
Wraps a DateFormat with format YYYYMMDDThhmmssZ able to display a date
in UTC time.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getTMXDate(java.util.Date date)
Returns the string representation of the date according to the preferred
TMX date format 'YYYYMMDDThhmmssZ'
|
java.lang.String |
getTMXDate(long 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
|
public TMXDateParser()
public java.util.Date parse(java.lang.String tmxDate) throws java.text.ParseException
tmxDate
- A date representation in YYYYMMDDThhmmssZ formatjava.text.ParseException
- if the date is null or not validpublic java.lang.String getTMXDate(java.util.Date date)
date
- a Date instancepublic java.lang.String getTMXDate(long date)
date
- unix timestamp (ms since 1970)