Date Format
In the field:
{
expression
Format
format
} where
expression
is a date, the format
is interpreted as a list of ingredients where each ingredient either specifies a component value (year, month, day) or is treated as a static character that will always appear. For example, in the format text:
"dd/mm/yyyy"
the ingredients are:
Ingredient | Description |
|---|---|
dd | day component (01-31) |
/ | static character |
mm | month component (01-12) |
/ | static character |
yyyy | year component |
Date ingredients
The full list of ingredients for a date value:
Ingredient | Description |
|---|---|
yyyy | year component formatted as a 4-digit number |
yy | year component formatted as a 2-digit number (00-99) |
YYYY | year component formatted as cardinal words (e.g. Two Thousand and Seven) |
YTH | year component formatted as ordinal words (e.g. Two Thousand and Seventh) |
yth | year component formatted as ordinal digits (e.g. 2007th) |
mm | month component formatted as 2 digits (01-12) |
m | month component formatted as 1 or 2 digits (1-12) |
MM | month component formatted as the full name (e.g. January) |
LMM | month component formatted as the full name in lowercase (e.g. january) |
UMM | month component formatted as the full name in uppercase (e.g. JANUARY) |
M | month component formatted as the abbreviated name (e.g. Jan) |
LM | month component formatted as the abbreviated name in lowercase (e.g. jan) |
UM | month component formatted as the abbreviated name in uppercase (e.g. JAN) |
MO | month ownership (e.g. of as in of April, d' as in d'Avril and de as in de Mai) |
dd | day component formatted as 2 digits (01-31) |
d | day component formatted as 1 or 2 digits (1-31) |
DD | day component formatted as cardinal words (e.g. Thirty One) |
LDD | day component formatted as cardinal words in lowercase (e.g. thirty one) |
UDD | day component formatted as cardinal words in uppercase (e.g. THIRTY ONE) |
DTH | day component formatted as ordinal words (e.g. Thirty First) |
LDTH | day component formatted as ordinal words in lowercase (e.g. thirty first) |
UDTH | day component formatted as ordinal words in uppercase (e.g. THIRTY FIRST) |
dth | day component formatted as ordinal digits (e.g. 31st) |
w | week-day component formatted as a single digit (1-7) |
WW | week-day component formatted as the full name (e.g. Monday) |
LWW | week-day component formatted as the full name in lowercase (e.g. monday) |
UWW | week-day component formatted as the full name in uppercase (e.g. MONDAY) |
W | week-day component formatted as the abbreviated name (e.g. Mon) |
LW | week-day component formatted as the abbreviated name in lowercase (e.g. mon) |
UW | week-day component formatted as the abbreviated name in uppercase (e.g. MON) |
WTH | week-day component formatted as ordinal words (e.g. First) |
LWTH | week-day component formatted as ordinal words in lowercase (e.g. first) |
UWTH | week-day component formatted as ordinal words in uppercase (e.g. FIRST) |
wth | week-day component formatted as ordinal digits (e.g. 1st) |
note
1. The names of months and week-days depend upon the locale setting in
Contract Express Administrator
.2. If you do not apply a format to a date variable it will use the locale format which is "d MM yyyy" for english_uk and "MM d, yyyy" for english_usa.
3. Date ingredients are case-sensitive, so m is different from M.
4. If you want the letter "d" to be treated as static text, use "^d". This applies to all ingredients, so "^d^t^h" represents the static text "dth".
Synonym formats
Synonym formats
The following are synonyms for applied formats:
Synonym | Applied Format |
|---|---|
"day_month_year" | "dd/mm/yyyy" |
"month_day_year" | "mm/dd/yyyy" |
"year_month_day" | "yyyy-mm-dd" |
Example 1
The following table gives the result of the expression:
value Format
format
for various date values and format texts.
Value | Format | Return |
|---|---|---|
Date( 2000, 2,29 ) | "yyyy-mm-dd" | "2000-02-29" |
Date( 2000, 2,29 ) | "dd/mm/yyyy" | "29/02/2000" |
Date( 2000, 2,9 ) | "dd/mm/yyyy" | "09/02/2000" |
Date( 2000, 2,9 ) | "d/m/yyyy" | "9/2/2000" |
Date( 2000, 2,29 ) | "the DTH ^day of MM" | "the Twenty Ninth day of February" |
Date( 2000, 2,29 ) | "the UDTH ^day of UMM" | "the TWENTY NINTH day of FEBRUARY" |
Example 2
The expression:
Text( Date( 2000, 2, 29 ), "" )
using the english_uk locale evaluates to:
"29 February 2000"
and using the english_usa locale evaluates to:
"February 29, 2000"