freemarker.template

## Interface TemplateDateModel

All Superinterfaces:
  TemplateModel

All Known Implementing Classes:
  DateModel, SimpleDate

    public interface TemplateDateModel
    extends TemplateModel

"date", "time" and "date-time" template language data types: corresponds to `Date`. Contrary to Java, FreeMarker distinguishes date (no time part), time and date-time values.

Objects of this type should be immutable, that is, calling `getAsDate()` and `getDateType()` should always return the same value as for the first time.

### Field Summary

Fields
`static int` `DATE` The date model represents a date value (no time part).
`static int` `DATETIME` The date model represents a date-time value (also known as timestamp).
`static int` `TIME` The date model represents a time value (no date part).
`static List` `TYPE_NAMES`
`static int` `UNKNOWN` It is not known whether the date represents a date, a time, or a date-time value.

### Fields inherited from interface freemarker.template.TemplateModel

`NOTHING`

### Method Summary

All Methods Instance Methods Abstract Methods
`Date` `getAsDate()` Returns the date value.
`int` `getDateType()` Returns the type of the date.

### Field Detail

#### UNKNOWN

    static final int UNKNOWN

It is not known whether the date represents a date, a time, or a date-time value. This often leads to exceptions in templates due to ambiguities it causes, so avoid it if possible.

See Also:
  Constant Field Values

#### TIME

    static final int TIME

The date model represents a time value (no date part).

See Also:
  Constant Field Values

#### DATE

    static final int DATE

The date model represents a date value (no time part).

See Also:
  Constant Field Values

#### DATETIME

    static final int DATETIME

The date model represents a date-time value (also known as timestamp).

See Also:
  Constant Field Values

#### TYPE_NAMES

    static final List TYPE_NAMES

### Method Detail

#### getAsDate

    Date getAsDate()
            throws TemplateModelException

Returns the date value. The return value must not be `null`.

Throws:
  `TemplateModelException`

#### getDateType

    int getDateType()

Returns the type of the date. It can be any of `TIME`, `DATE`, or `DATETIME`.