Date
The Date element inserts the current system date, optionally making it dynamic so that it updates whenever the template is viewed or produces output.
Adding a date
To add a Date element, use the Insert > Date option in the menus. A dialog appears with the following controls:
-
Language: Use the drop-down to select which language the date should be displayed in.
-
Update Automatically: Check to update the date automatically when the template is viewed or produces output. When this option is checked, a placeholder is inserted in the template and a script is created to update it automatically, otherwise a static text with the date is inserted.
-
Available Formats: Select the date/time format in which to display the date.
Click OK to insert the date or Cancel to close the dialog.
Tip: If you are looking to add a date that originates from a record set, to a template, see: Variable data in the text. To insert a date you could use either the drag and drop method or the Wizard; the latter lets you set the date/time format.
Changing the date
Once inserted, a date can be modified directly in the template (if it does not update automatically) or through the date script (if it does update automatically). To modify the date in the script:
-
Double-click the date script in the Scripts pane.
-
Between the round brackets after Date, enter the desired date in the following order: year, month, day, and optionally hours, minutes, seconds, milliseconds (see MDN Web Docs - Date object). When the time is omitted, it defaults to 12:00:00 AM.
Formatting an automatically updating date
The script added to automatically update the date uses the short date format. To change this:
-
Double-click the date script in the Scripts pane.
-
Delete the first line of the script.
-
On the second line, delete what comes after
format
and changeformat
toformatter
(see formatter). -
Now type a dot after
formatter
, press Ctrl + space and choose one of the functions to format a date and time; see Date, date/time and time functions.
Note: The Locale, set in the Edit > Locale dialog, has an influence on the formatting of a date. The Locale can be the system's locale, a specific locale, or it can depend on the value of a data field or runtime parameter; see Locale.