Package org.jxmpp.util
Class XmppDateTime
java.lang.Object
org.jxmpp.util.XmppDateTime
Utility class for date and time handling in XMPP.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Converts a time zone to the String format as specified in XEP-0082.static String
convertRfc822TimezoneToXep82
(String dateString) Convert a RFC 822 Timezone to the Timezone format used in XEP-82.static String
convertXep82TimezoneToRfc822
(String dateString) Converts a XEP-0082 date String's time zone definition into a RFC822 time zone definition.static String
formatXEP0082Date
(Date date) Formats a Date into a XEP-0082 - XMPP Date and Time Profiles string.static Date
Parses the given date string in either of the three profiles of XEP-0082 - XMPP Date and Time Profiles or XEP-0091 - Legacy Delayed Delivery format.static Date
parseXEP0082Date
(String dateString) Parses the given date string in the XEP-0082 - XMPP Date and Time Profiles.
-
Constructor Details
-
XmppDateTime
public XmppDateTime()
-
-
Method Details
-
parseXEP0082Date
Parses the given date string in the XEP-0082 - XMPP Date and Time Profiles.- Parameters:
dateString
- the date string to parse- Returns:
- the parsed Date
- Throws:
ParseException
- if the specified string cannot be parsed
-
parseDate
Parses the given date string in either of the three profiles of XEP-0082 - XMPP Date and Time Profiles or XEP-0091 - Legacy Delayed Delivery format.This method uses internal date formatters and is thus threadsafe.
- Parameters:
dateString
- the date string to parse- Returns:
- the parsed Date
- Throws:
ParseException
- if the specified string cannot be parsed
-
formatXEP0082Date
Formats a Date into a XEP-0082 - XMPP Date and Time Profiles string.- Parameters:
date
- the time value to be formatted into a time string- Returns:
- the formatted time string in XEP-0082 format
-
convertXep82TimezoneToRfc822
Converts a XEP-0082 date String's time zone definition into a RFC822 time zone definition. The major difference is that XEP-0082 uses a semicolon between hours and minutes and RFC822 does not.- Parameters:
dateString
- the date String.- Returns:
- the String with converted timezone
-
convertRfc822TimezoneToXep82
Convert a RFC 822 Timezone to the Timezone format used in XEP-82.- Parameters:
dateString
- the input date String.- Returns:
- the input String with the timezone converted to XEP-82.
-
asString
Converts a time zone to the String format as specified in XEP-0082.- Parameters:
timeZone
- the time zone to convert.- Returns:
- the String representation of the TimeZone
-