Dynamic Text Variables for Time and Date
With dynamic text variables, you can enable time and date to be automatically added to your content during the Publish Content. Since the information is retrieved from your browser's client session time and date, it will be accurate for your location. To find out more about the syntax for time and date variables, see SimpleDateFormat (Java 2 Platform SE 5.0).
To Insert a Dynamic Text Variable in your topics, add the references using the appropriate syntax in a phrase
element. There are many
different ways of displaying the time and date and we have included some examples below.
Syntax |
Returns |
|
---|---|---|
${date:date-time()}$ |
The current date, time, and timezone information. |
|
${date:format-usertime('h:m')}$ |
The current hour and minutes. Use this function for greater control over the format of the date and time in the output. Set the arguments for the function in brackets, where string arguments must be enclosed in single quotes (as shown in the table). |
|
${date:format-usertime('EEE, MMM d, yyyy')}$ |
The current day, month, and year. |
|
${date:format-unixtime(ancestor::d:section[@xinfo:time-modified][1]/@xinfo:time-modified, 'EEE, MMM d, yyyy')}$ |
This syntax formats the Unix time stamp into readable text: Thu, Aug 10, 2023. Replace the date format in the syntax to change how the date is presented. To find suggestions, see Simple Date Format. If |