#calendar.<VariableName>#
Usage
Exposes a set of functions that are available for retrieving and formatting various dates and times. Two functions are available:
getDateTime(...) returns formatted datetime
getDBDate(...) returns date formatted in the underlying database format.
Both of these functions accept a date specifier string as the first parameter.
Example
#calendar.getDateTime("YESTERDAY", "MM/dd/yyyy")#
Displays yesterday’s date in MM/dd/yyyy format.
Date Specifiers:
- NOW
- TOMORROW
- YESTERDAY
- THIS_WEEK_START_DATE
- THIS_WEEK_END_DATE
- LAST_WEEK_START_DATE
- LAST_WEEK_END_DATE
- THIS_MONTH_START_DATE
- THIS_MONTH_END_DATE
- LAST_MONTH_START_DATE
- THIS_YEAR_START_DATE
- THIS_YEAR_END_DATE
- LAST_YEAR_START_DATE
- LAST_YEAR_END_DATE
In addition to a date specifier, the getDateTime(...) function can accept a second parameter—the date format mask. Mask is a standard Java SimpleDateFormater mask, consisting of the following symbols:
| Symbol | Meaning | Presentation | Example |
|---|---|---|---|
| G | era designator | (Text) | AD |
| y | year | (Number) | 1996 |
| M | month in year | (Text & Number) | July & 07 |
| D | day in month | (Number) | 10 |
| h | hour in am or pm (1~12) | (Number) | 12 |
| H | hour in day (0~23) | (Number) | 0 |
| m | minute in hour | (Number) | 30 |
| s | second in minute | (Number) | 55 |
| S | millisecond | (Number) | 978 |
| E | day in week | (Text) | Tuesday |
| D | day in year | (Number) | 189 |
| F | day of week in month | (Number) | 2 (2nd Wed in July) |
| w | week in year | (Number) | 27 |
| W | week in month | (Number) | 2 |
| a | am or pm marker | (Text) | PM |
| K | hour in day (1~24) | (Number) | 24 |
| K | hour in am or pm (0~11) | (Number) | 0 |
| z | time zone | (Text) | Pacific Standard Time |
| ' | escape for text | (Delimiter) | |
| '' | single quote | (Literal) | ' |