Skip to main content

Clocks

By default, the {TIME} code uses the current time. A custom clock can be used instead, so that the printed date and time is taken from a value set by an operator rather than from the printer's own clock.

A custom clock is a named, fixed date and time value. Clocks are created using the Web UI or the Clocks API. A typical use case is a production date that is set once and then used by one or more labels. A clock can be marked as user editable, in which case the operator is asked to confirm or change its value when selecting a label that uses it.

Syntax

The clock name is given as the fourth argument of the {TIME} code:

{TIME;format;offset;clock}

Both the offset and the clock are optional. To use a clock without an offset, leave the offset argument empty but keep its semicolon:

{TIME;@YYYY-MM-DD;;PRODDATE}

If an offset is given, it is applied to the clock's date and time instead of the current time. This makes it easy to print derived dates, such as a best before date calculated from a production date.

Referencing a clock that does not exist is an error, and the label will fail to print.

Examples

The examples below assume a clock named PRODDATE set to 16 May 2026.

  • {TIME;@YYYY-MM-DD;;PRODDATE}
    The clock value using a predefined format: "2026-05-16".
  • {TIME;@DD/MM/YY;;PRODDATE}
    The same clock with another format: "16/05/26".
  • {TIME;@YYYY-MM-DD;+6months;PRODDATE}
    A best before date six months after the production date: "2026-11-16".
  • {TIME;@YYYY-MM-DD;+1year-1day;PRODDATE}
    One year minus one day after the production date: "2027-05-15".
  • {TIME;{DAYOFMONTH} {MONTH;FORMAT=shortmonth} {YEAR};;PRODDATE}
    Individual components formatted from the clock: "16 MAY 2026".
  • {TIME;{WEEK};;PRODDATE}
    The week number of the production date: "20".
  • {TIME;@YYYY-MM-DD;+{VARIABLE;SHELF_LIFE}days;PRODDATE}
    A best before date where the shelf life in days is taken from the variable SHELF_LIFE.

Note that components like {DAYOFMONTH} only use the clock when placed inside a {TIME} code that selects it. A standalone {DAYOFMONTH} always uses the current time.