Date and Time Formatting
Formatting date and time can quickly become a chore. Label LIVE variables can be configured to parse an input date and format it to conform to your exact needs.
Common Uses for Date and Time
Packed on date (e.g. today)
Future expiration date (e.g. next Friday)
Production timestamp (e.g. now)
Lot/batch code
Julian date codes
How Date Variables Work
Once you understand how basic variables work in Label LIVE, you might want extra functionality. Label LIVE supports "DATE" variables. Create a new DATE variable by choosing the Kind. For this example we will create a DATE variable named EXPIRATION.
Existing Variables
If you already have variables (via importing) all variables will default to Plain Text.
Change an existing variable's type by clicking on the variable Setup (gear icon).
Once changed to DATE, you will see a default date format and a calendar icon near the variable name.
Date and Time Input
Like other variables in Label LIVE, the input is used to determine what is printed on the label. Date variables expect some kind of date or time as input. These can be either absolute dates or relative dates.
Absolute Date and Time
Absolute inputs are an exact date or time such as January 1st, 2020. Common input formats are supported such as:
January 1st, 2000
15 August 1969 420pm
1/1/2023
Note: Beware using formats where the day/month can be unintentionally swapped. The United States is one of the few countries that uses the m/d/yy format.
Relative Date and Time
Relative inputs are short phrases that represent a date or time relative to the current date and time. Examples include:
now (includes exact time)
today (defaults to midnight)
next friday at 2200
tomorrow + two weeks
in 400 days
30 days ago
Date and Time Output Formats
Output formats use "tokens" to create the desired output. The simplest example of a token is YYYY
which is the year, or 2023. If you only need the last two digits of the year, then the token is YY
. Tokens are available for every part of a date and time, including day of week, month (e.g. January, Jan, 1, 01). The full token format list is available by clicking the DATE variable's calendar icon, and clicking inside the Format field:
Formatting a Julian Date, Other Lot Codes
A julian date is the "Day of Year" and is formatted with the token DDDD
.
Similarly, "Week of Year" is formatted with the token WW
.
Zero Padding
Pay special attention to tokens like M
vs. MM
. While they may seem identical for inputs such as 20, they are different when the input is < 10, for example, the 9th month (September) is formatted M
"9" whereas MM
is "09". Similarly, YYYY
is a zero-padded year, whereas YY
is the last two numbers of the year: 2023 and 23, respectively.
Zero padded formats are useful for barcodes that require a fixed length.
Locale Support
Locale dates such as L
, LL
, LLL
, LLLL
are common formats that change based on the locale setup in Label LIVE Settings. Locale may impact the name of months, days of week. Here's an example of Spanish.
Common Pitfalls
Dates and times may seem easy, but there are many gray areas that you should consider.
Language and Region Differences
Locales will re-arrange the day and month placeholders for the common shorthand... be careful because these are not 100% distinguishable. For example, is "1/2/23" referring to "Jan 2" or "Feb 1"?
Uniqueness
Do not use seconds as a unique field because multiple labels can be printed in under one second.
If all else fails...
You can always use Microsoft Excel to format the date into text. Label LIVE will then proceed as normal, printing exactly what is specified in input data. Just remember to change your Variable Type back to "Plain Text."