ZPL II Samples
ZPL II Samples

ZPL II Samples

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:
^XA ^SL ^SO2,3,0,0,1,0,0^FS ^SO3,0,0,-1,0,0,0^FS ^XZ
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.
For the below example, the
^FC
command delimiters are:
%
Primary clock indicator
{
Secondary clock indicator
#
Third clock indicator
^XA ^LL175 ^FO10,025^AD^FC%,{,#^FD1: Mil: %H:%M:%S Civ: %I:%M:%S %p^FS ^FO10,050^AD^FC%,{,#^FD2: Mil: {H:{M:{S Civ: {I:{M:{S {p^FS ^FO10,075^AD^FC%,{,#^FD3: Mil: #H:#M:#S Civ: #I:#M:#S #p^FS ^FO10,100^AD^FC%,{,#^FD1: On %A, %B %d , %Y (%a, %m/%d/%y, %d %b %Y).^FS ^FO10,125^AD^FC%,{,#^FD2: On {A, {B {d, {Y ( {a, {m/{d/{y, {d {b {Y).^FS ^FO10,150^AD^FC%,{,#^FD3: On #A, #B #d, #Y ( #a, #m/#d/#y, #d #b #Y).^FS ^XZ
Printed Result of the Above ZPL II Script
The following are examples of the time stamp using the
^SL1
and
^SL5
at 2 ips and 10 ips for the Enhanced Real Time Clock (V60.13.0.10 and later).
They show the variation of time due to print speed and label complexity.
^XA ^SL1^FS ^FO187,184^A0N,101,121^FC%^FD%H:%M:%S^FS ^PQ10 ^XZ
Example of ^SL1, 2 ips and 10 ips
1
Label 1
6
Label 6
2
Label 2
7
Label 7
3
Label 3
8
Label 8
4
Label 4
9
Label 9
5
Label 5
10
Label 10
^XA ^SL5^FS ^FO187,184^A0N,101,121^FC%^FD%H:%M:%S^FS ^PQ10 ^XZ
Example of ^SL5, 2 ips and 10 ips
1
Label 1
6
Label 6
2
Label 2
7
Label 7
3
Label 3
8
Label 8
4
Label 4
9
Label 9
5
Label 5
10
Label 10