Class JodaDateFormatter

    • Constructor Summary

      Constructors 
      Constructor Description
      JodaDateFormatter​(java.lang.String pattern, org.joda.time.format.DateTimeFormatter parser, org.joda.time.format.DateTimeFormatter printer)  
    • Method Summary

      Modifier and Type Method Description
      java.lang.String format​(java.time.temporal.TemporalAccessor accessor)
      Print the supplied java time accessor in a string based representation according to this formatter
      java.lang.String formatJoda​(org.joda.time.DateTime dateTime)
      Return the given Joda DateTime formatted with this format.
      java.lang.String formatMillis​(long millis)
      Return the given millis-since-epoch formatted with this format.
      java.util.Locale locale()
      Returns the configured locale of the date formatter
      java.time.temporal.TemporalAccessor parse​(java.lang.String input)
      Try to parse input to a java time TemporalAccessor using joda-time library.
      org.joda.time.DateTime parseJoda​(java.lang.String input)
      Parse the given input into a Joda DateTime.
      long parseMillis​(java.lang.String input)
      Parse the given input into millis-since-epoch.
      java.lang.String pattern()
      A name based format for this formatter.
      DateMathParser toDateMathParser()
      Return a DateMathParser built from this formatter.
      DateFormatter withLocale​(java.util.Locale locale)
      Create a copy of this formatter that is configured to parse dates in the specified locale
      JodaDateFormatter withYear​(int year)  
      DateFormatter withZone​(java.time.ZoneId zoneId)
      Create a copy of this formatter that is configured to parse dates in the specified time zone
      java.time.ZoneId zone()
      Returns the configured time zone of the date formatter
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JodaDateFormatter

        public JodaDateFormatter​(java.lang.String pattern,
                                 org.joda.time.format.DateTimeFormatter parser,
                                 org.joda.time.format.DateTimeFormatter printer)
    • Method Detail

      • parse

        public java.time.temporal.TemporalAccessor parse​(java.lang.String input)
        Try to parse input to a java time TemporalAccessor using joda-time library.
        Specified by:
        parse in interface DateFormatter
        Parameters:
        input - An arbitrary string resembling the string representation of a date or time
        Returns:
        The java time object containing the parsed input
        Throws:
        java.lang.IllegalArgumentException - if the text to parse is invalid
        java.time.DateTimeException - if the parsing result exceeds the supported range of ZoneDateTime or if the parsed instant exceeds the maximum or minimum instant
        See Also:
        DateFormatter.parse(String)
      • parseMillis

        public long parseMillis​(java.lang.String input)
        Description copied from interface: DateFormatter
        Parse the given input into millis-since-epoch.
        Specified by:
        parseMillis in interface DateFormatter
      • parseJoda

        public org.joda.time.DateTime parseJoda​(java.lang.String input)
        Description copied from interface: DateFormatter
        Parse the given input into a Joda DateTime.
        Specified by:
        parseJoda in interface DateFormatter
      • withZone

        public DateFormatter withZone​(java.time.ZoneId zoneId)
        Description copied from interface: DateFormatter
        Create a copy of this formatter that is configured to parse dates in the specified time zone
        Specified by:
        withZone in interface DateFormatter
        Parameters:
        zoneId - The time zone to act on
        Returns:
        A copy of the date formatter this has been called on
      • withLocale

        public DateFormatter withLocale​(java.util.Locale locale)
        Description copied from interface: DateFormatter
        Create a copy of this formatter that is configured to parse dates in the specified locale
        Specified by:
        withLocale in interface DateFormatter
        Parameters:
        locale - The local to use for the new formatter
        Returns:
        A copy of the date formatter this has been called on
      • format

        public java.lang.String format​(java.time.temporal.TemporalAccessor accessor)
        Description copied from interface: DateFormatter
        Print the supplied java time accessor in a string based representation according to this formatter
        Specified by:
        format in interface DateFormatter
        Parameters:
        accessor - The temporal accessor used to format
        Returns:
        The string result for the formatting
      • formatJoda

        public java.lang.String formatJoda​(org.joda.time.DateTime dateTime)
        Description copied from interface: DateFormatter
        Return the given Joda DateTime formatted with this format.
        Specified by:
        formatJoda in interface DateFormatter
      • formatMillis

        public java.lang.String formatMillis​(long millis)
        Description copied from interface: DateFormatter
        Return the given millis-since-epoch formatted with this format.
        Specified by:
        formatMillis in interface DateFormatter
      • pattern

        public java.lang.String pattern()
        Description copied from interface: DateFormatter
        A name based format for this formatter. Can be one of the registered formatters like epoch_millis or a configured format like HH:mm:ss
        Specified by:
        pattern in interface DateFormatter
        Returns:
        The name of this formatter
      • locale

        public java.util.Locale locale()
        Description copied from interface: DateFormatter
        Returns the configured locale of the date formatter
        Specified by:
        locale in interface DateFormatter
        Returns:
        The locale of this formatter
      • zone

        public java.time.ZoneId zone()
        Description copied from interface: DateFormatter
        Returns the configured time zone of the date formatter
        Specified by:
        zone in interface DateFormatter
        Returns:
        The time zone of this formatter