Class XmppDateTime

    • Constructor Detail

      • XmppDateTime

        public XmppDateTime()
    • Method Detail

      • parseXEP0082Date

        public static java.util.Date parseXEP0082Date​(java.lang.String dateString)
                                               throws java.text.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:
        java.text.ParseException - if the specified string cannot be parsed
      • parseDate

        public static java.util.Date parseDate​(java.lang.String dateString)
                                        throws java.text.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:
        java.text.ParseException - if the specified string cannot be parsed
      • formatXEP0082Date

        public static java.lang.String formatXEP0082Date​(java.util.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 java.lang.String convertXep82TimezoneToRfc822​(java.lang.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 semicolon between hours and minutes and RFC822 does not.
        Parameters:
        dateString - the date String.
        Returns:
        the String with converted timezone
      • convertRfc822TimezoneToXep82

        public static java.lang.String convertRfc822TimezoneToXep82​(java.lang.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.
      • asString

        public static java.lang.String asString​(java.util.TimeZone timeZone)
        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