Package org.jivesoftware.util
Class XMPPDateTimeFormat
- java.lang.Object
-
- org.jivesoftware.util.XMPPDateTimeFormat
-
public class XMPPDateTimeFormat extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
XMPP_DATE_FORMAT
static String
XMPP_DATETIME_FORMAT
Date/time format for use by SimpleDateFormat.static String
XMPP_DATETIME_FORMAT_WO_MILLIS_WO_TIMEZONE
static String
XMPP_DATETIME_FORMAT_WO_TIMEZONE
static String
XMPP_DELAY_DATETIME_FORMAT
Date/time format for use by SimpleDateFormat.static String
XMPP_TIME_FORMAT
static String
XMPP_TIME_FORMAT_WO_MILLIS
-
Constructor Summary
Constructors Constructor Description XMPPDateTimeFormat()
Create a new thread-safe instance of this utility class
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
format(Date date)
Formats a Date object to String as defined in XEP-0082.Date
parseString(String dateString)
Tries to convert a given string to a Date object.
-
-
-
Field Detail
-
XMPP_DATETIME_FORMAT
public static final String XMPP_DATETIME_FORMAT
Date/time format for use by SimpleDateFormat. The format conforms to XEP-0082, which defines a unified date/time format for XMPP.- See Also:
- Constant Field Values
-
XMPP_DATETIME_FORMAT_WO_TIMEZONE
public static final String XMPP_DATETIME_FORMAT_WO_TIMEZONE
- See Also:
- Constant Field Values
-
XMPP_DATETIME_FORMAT_WO_MILLIS_WO_TIMEZONE
public static final String XMPP_DATETIME_FORMAT_WO_MILLIS_WO_TIMEZONE
- See Also:
- Constant Field Values
-
XMPP_DATE_FORMAT
public static final String XMPP_DATE_FORMAT
- See Also:
- Constant Field Values
-
XMPP_TIME_FORMAT
public static final String XMPP_TIME_FORMAT
- See Also:
- Constant Field Values
-
XMPP_TIME_FORMAT_WO_MILLIS
public static final String XMPP_TIME_FORMAT_WO_MILLIS
- See Also:
- Constant Field Values
-
XMPP_DELAY_DATETIME_FORMAT
public static final String XMPP_DELAY_DATETIME_FORMAT
Date/time format for use by SimpleDateFormat. The format conforms to the format defined in XEP-0091, a specialized date format for historical XMPP usage.- See Also:
- Constant Field Values
-
-
Method Detail
-
parseString
public Date parseString(String dateString) throws ParseException
Tries to convert a given string to a Date object. This method supports the format types defined by XEP-0082 and the format defined in legacy protocols XEP-0082: CCYY-MM-DDThh:mm:ss[.sss]TZD legacy: CCYYMMDDThh:mm:ss This method either returns a Date instance as result or it will return null or throw a ParseException in case the String couldn't be parsed.- Parameters:
dateString
- the String that should be parsed- Returns:
- the parsed date or null if the String could not be parsed
- Throws:
ParseException
- if the date could not be parsed
-
-