Package org.jxmpp.util
Class XmppDateTime
- java.lang.Object
-
- org.jxmpp.util.XmppDateTime
-
public class XmppDateTime extends Object
Utility class for date and time handling in XMPP.- See Also:
- XEP-82: XMPP Date and Time Profiles
-
-
Constructor Summary
Constructors Constructor Description XmppDateTime()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
asString(TimeZone timeZone)
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
parseDate(String dateString)
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 Detail
-
XmppDateTime
public XmppDateTime()
-
-
Method Detail
-
parseXEP0082Date
public static Date parseXEP0082Date(String dateString) throws ParseException
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
public static Date parseDate(String dateString) throws ParseException
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
public static String formatXEP0082Date(Date date)
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
public static String convertXep82TimezoneToRfc822(String dateString)
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 smicolon between hours and minutes and RFC822 does not.- Parameters:
dateString
- the date String.- Returns:
- the String with converted timezone
-
convertRfc822TimezoneToXep82
public static String convertRfc822TimezoneToXep82(String dateString)
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.
-
-