Class TemplateDateFormat


  • public abstract class TemplateDateFormat
    extends TemplateValueFormat
    Represents a date/time/dateTime format; used in templates for formatting and parsing with that format. This is similar to Java's DateFormat, but made to fit the requirements of FreeMarker. Also, it makes easier to define formats that can't be represented with Java's existing DateFormat implementations.

    Implementations need not be thread-safe if the TemplateNumberFormatFactory doesn't recycle them among different Environment-s. As far as FreeMarker's concerned, instances are bound to a single Environment, and Environment-s are thread-local objects.

    Since:
    2.3.24
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object format​(TemplateDateModel dateModel)
      Formats the model to markup instead of to plain text if the result markup will be more than just plain text escaped, otherwise falls back to formatting to plain text.
      abstract java.lang.String formatToPlainText​(TemplateDateModel dateModel)  
      abstract boolean isLocaleBound()
      Tells if this formatter should be re-created if the locale changes.
      abstract boolean isTimeZoneBound()
      Tells if this formatter should be re-created if the time zone changes.
      abstract java.lang.Object parse​(java.lang.String s, int dateType)
      Parsers a string to date/time/datetime, according to this format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait