Package org.deckfour.xes.util
Class XsDateTimeConversion
- java.lang.Object
-
- org.deckfour.xes.util.XsDateTimeConversion
-
- Direct Known Subclasses:
XsDateTimeConversionJava7
public class XsDateTimeConversion extends java.lang.ObjectThis class serves as a provider for static xs:dateTime-related manipulation and parsing methods.- Author:
- Christian W. Guenther (christian at deckfour dot org)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.GregorianCalendarcalCalendar instance used for calculating dates for timestampsprotected java.text.SimpleDateFormatdfMillisTZoneDate/Time parsing instance with milliseconds and time zone information.protected static java.lang.StringXSDATETIME_FORMAT_STRING_MILLIS_TZONEDate/Time parsing format including milliseconds and time zone information.protected java.util.regex.PatternxsDtPatternPattern used for matching the XsDateTime formatted timestamp strings.
-
Constructor Summary
Constructors Constructor Description XsDateTimeConversion()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringformat(java.util.Date date)Formats a given date to the xs:dateTime format of XML.java.util.DateparseXsDateTime(java.lang.String xsDateTime)Expects an XML xs:dateTime lexical format string, as in2005-10-24T11:57:31.000+01:00.
-
-
-
Field Detail
-
XSDATETIME_FORMAT_STRING_MILLIS_TZONE
protected static final java.lang.String XSDATETIME_FORMAT_STRING_MILLIS_TZONE
Date/Time parsing format including milliseconds and time zone information.- See Also:
- Constant Field Values
-
dfMillisTZone
protected final java.text.SimpleDateFormat dfMillisTZone
Date/Time parsing instance with milliseconds and time zone information.
-
xsDtPattern
protected final java.util.regex.Pattern xsDtPattern
Pattern used for matching the XsDateTime formatted timestamp strings.
-
cal
protected java.util.GregorianCalendar cal
Calendar instance used for calculating dates for timestamps
-
-
Method Detail
-
parseXsDateTime
public java.util.Date parseXsDateTime(java.lang.String xsDateTime)
Expects an XML xs:dateTime lexical format string, as in2005-10-24T11:57:31.000+01:00. Some bad MXML files miss timezone or milliseconds information, thus a certain amount of tolerance is applied towards malformed timestamp string representations. If unparseable, this method will returnnull.- Parameters:
xsDateTime- Timestamp string in the XML xs:dateTime format.- Returns:
- Parsed Date object.
-
format
public java.lang.String format(java.util.Date date)
Formats a given date to the xs:dateTime format of XML.- Parameters:
date- Date to be formatted.- Returns:
- String formatting the given date.
-
-