Skip to main content

Date and time

The date and time dynamic text codes are by far the most advanced and powerful codes. They are easy to use in their basic form, but have a lot of flexibility to add offsets and control the formatting of the numbers.

There are two main options when using date/time codes: predefined composite formats, or individual components like the year, month, hour, etc.

To use predefined formats, the {TIME} code is used with the name of the format as parameter (prefixed by a "@" character), e.g. {TIME;@YYYY-MM-DD}.

The individual components can either be placed inside a {TIME} code as in {TIME;{HOUR}}, or standalone as in {HOUR}. The advantage of placing the components inside a {TIME} code is mainly to apply an offset to create best before dates.

Best before: {TIME;@YYYY-MM-DD;+20days}

The built-in format YYYY-MM-DD is just a short form for {YEAR}-{MONTH}-{DAYOFMONTH}, so the following dynamic text is equivalent:

Best before: {TIME;{YEAR}-{MONTH}-{DAYOFMONTH};+20days}