You are here: Designer > Features > Content elements > Date
 

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, 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.

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:

  1. Double-click the date script in the Scripts pane.
  2. Between the round brackets after Date, enter the desired date in the following order: year, month, day, and optionally hours, minutes, seconds, milliseconds (see http://www.w3schools.com/js/js_dates.asp and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date.) 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:

  1. Double-click the date script in the Scripts pane.
  2. Delete the first line of the script.
  3. On the second line, delete what comes after format and change format to formatter (see formatter).
  4. 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.
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; see Locale.