Page tree

_Dateformat

Dateformat() is used to display a date/time field in a particular format, often for localization. Dateformat() takes two arguments: the desired pattern format, and the field variable. Date time patterns are indicated with a series of letters that represent elements such as month, day in month, day of week, year, hour, and minute. For a full list of possible formats see this page from Java about SimpleDateFormat().

Syntax

dateformat("output pattern","$field")
 Date/time PatternExample output
"MM/dd/yy"05/31/16
"yyyy/dd/MM"2016/22/09
"MMMMM"July (name of month)
"d"10 (day of month)

Examples

The following results are expected when $contract_start_date evaluates to February 10, 2016 at 01:00:00.

FormulaSample output
 $formula(dateformat("d",$contract_start_date)) 10. Inserts which day of the month the contract starts.
$formula(dateformat("MMMMM",$contract_start_date))
February. Inserts the full text name of the month.
$formula(dateformat("yyyy",$contract_start_date))
2016. Inserts the year of the contract start date.
$formula(dateformat("MM/dd/yyyy hh:mm",NOW()))Inserts the current date and timestamp when the document template runs.

CONTENTS
  • No labels