org.springframework.format.datetime.standard

Class DateTimeFormatterFactory

  • java.lang.Object
    • org.springframework.format.datetime.standard.DateTimeFormatterFactory
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.time.format.DateTimeFormatter createDateTimeFormatter()
      Create a new DateTimeFormatter using this factory.
      java.time.format.DateTimeFormatter createDateTimeFormatter(java.time.format.DateTimeFormatter fallbackFormatter)
      Create a new DateTimeFormatter using this factory.
      void setDateStyle(java.time.format.FormatStyle dateStyle)
      Set the style to use for date types.
      void setDateTimeStyle(java.time.format.FormatStyle dateTimeStyle)
      Set the style to use for date and time types.
      void setIso(DateTimeFormat.ISO iso)
      Set the ISO format used to format date values.
      void setPattern(java.lang.String pattern)
      Set the pattern to use to format date values.
      void setStylePattern(java.lang.String style)
      Set the two characters to use to format date values, in Joda-Time style.
      void setTimeStyle(java.time.format.FormatStyle timeStyle)
      Set the style to use for time types.
      void setTimeZone(java.util.TimeZone timeZone)
      Set the TimeZone to normalize the date values into, if any.
      • Methods inherited from class java.lang.Object

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

      • DateTimeFormatterFactory

        public DateTimeFormatterFactory()
        Create a new DateTimeFormatterFactory instance.
      • DateTimeFormatterFactory

        public DateTimeFormatterFactory(java.lang.String pattern)
        Create a new DateTimeFormatterFactory instance.
        Parameters:
        pattern - the pattern to use to format date values
    • Method Detail

      • setPattern

        public void setPattern(java.lang.String pattern)
        Set the pattern to use to format date values.
        Parameters:
        pattern - the format pattern
      • setIso

        public void setIso(DateTimeFormat.ISO iso)
        Set the ISO format used to format date values.
        Parameters:
        iso - the ISO format
      • setDateStyle

        public void setDateStyle(java.time.format.FormatStyle dateStyle)
        Set the style to use for date types.
      • setTimeStyle

        public void setTimeStyle(java.time.format.FormatStyle timeStyle)
        Set the style to use for time types.
      • setDateTimeStyle

        public void setDateTimeStyle(java.time.format.FormatStyle dateTimeStyle)
        Set the style to use for date and time types.
      • setTimeZone

        public void setTimeZone(java.util.TimeZone timeZone)
        Set the TimeZone to normalize the date values into, if any.
        Parameters:
        timeZone - the time zone
      • createDateTimeFormatter

        public java.time.format.DateTimeFormatter createDateTimeFormatter()
        Create a new DateTimeFormatter using this factory.

        If no specific pattern or style has been defined, medium date time format will be used.

        Returns:
        a new date time formatter
        See Also:
        createDateTimeFormatter(DateTimeFormatter)
      • createDateTimeFormatter

        public java.time.format.DateTimeFormatter createDateTimeFormatter(java.time.format.DateTimeFormatter fallbackFormatter)
        Create a new DateTimeFormatter using this factory.

        If no specific pattern or style has been defined, the supplied fallbackFormatter will be used.

        Parameters:
        fallbackFormatter - the fall-back formatter to use when no specific factory properties have been set
        Returns:
        a new date time formatter