Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jivesoftware.util
Class XMPPDateTimeFormat

    java.lang.Object
      org.jivesoftware.util.XMPPDateTimeFormat

    public class XMPPDateTimeFormat

extends Object

Utility class for date/time format conversions as specified in XEP-0082 and XEP-0090 and For Date -> String converstion FastDateFormat is used

Field Summary
`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
`XMPPDateTimeFormat()` Create a new thread-safe instance of this utility class

Method Summary
`static String` | `format(Date date)` Formats a Date object to String as defined in XEP-0082.
`static String` | `formatOld(Date date)` Formats a Date object to String as defined in legacy XMPP protocols (e.g.
`Date` | `parseOldDate(String dateStr)` Tries to convert a given string to a Date object.
`Date` | `parseString(String dateString)` Tries to convert a given string to a Date object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

Constructor Detail

### XMPPDateTimeFormat

    public XMPPDateTimeFormat()

  Create a new thread-safe instance of this utility class

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:
    `dateStr` - the String that should be parsed
  Returns:
    the parsed date or null if the String could not be parsed
  Throws:
    `ParseException`

### parseOldDate

    public Date parseOldDate(String dateStr)
                      throws ParseException

  Tries to convert a given string to a Date object. This method only supports the legacy XMPP time format: 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:
    `dateStr` -
  Returns:
    the parsed date or null if the String could not be parsed
  Throws:
    `ParseException`

### format

    public static String format(Date date)

  Formats a Date object to String as defined in XEP-0082. The resulting String will have the timezone set to UTC ('Z') and includes milliseconds: CCYY-MM-DDThh:mm:ss.sssZ

  Parameters:
    `date` -
  Returns:

### formatOld

    public static String formatOld(Date date)

  Formats a Date object to String as defined in legacy XMPP protocols (e.g. XEP-0090) CCYYMMDDThh:mm:ss

  Parameters:
    `date` -
  Returns:

Overview | Package | Class | Tree | Deprecated | Index | Help
| Openfire 3.8.2 Javadoc
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Jive Software.