The ZPL II scripts shown on this page establish the initial settings for the date and time clock. The script below then references these settings to provide the output shown in Figure 1.
Setting the date and time for the Real Time Clock only needs to be done once. The date and time are maintained by an on-board battery when the printer is reset or the printer is turned Off (O).
To set the date and time to April 23, 2005 at 2:30pm, the following command string should be sent to the printer:
^XA
^ST04,23,2005,02,30,0,P^FS
^XZ
To initialize the Real Time Clock and set up two offset values (offset #2 set to 3 months and 1 hour in the future, offset #3 set to 1 year in the past), the following command sequence should be sent to the printer:
The above ZPL II scripts initialize the RTC date and time and must be sent to a printer to provide proper date and time parameters for the ZPL II script below.
The following ZPL II script illustrates the various methods of printing the date and time initialized in the script above within separate fields on continuous media. Figure 1illustrates the printout of this script on a label.