Date / Time Format Changes When Label is Printed in Different Country – CODESOFT Problem Article
Summary
A label design works perfectly when tested in development. However, when it was sent to the another site for testing or production, some of the data fields were printed with incorrect format. The data fields that have this problem are either Date, Time or Currency type.
Situation and Symptoms
In a label design, you have a ‘When printed’ object called ExpiryDate it contains value of 20190401. You have a formula to calculate expiry in MMM/YY format – Upper(BestBefore(left({ExpiryDate},6) ,”yyyymm”,-0,”m”, 0,”mmm/yy”,0)). This formula produces APR/19.
However, when the label design is sent to a plant in Mexico, the output is a little different. It added a period after APR. (APR./19)
Explanation
This is a result of globalization settings in Windows. Different counties have different way of displaying date, time and currency. For example, United State display date in MM/DD/YYYY, Mexico displays it in DD/MM/YYYY.
In the example above, the function BestBefore requires several parameters. For the purpose of this article, I would not go into each of them. The last parameter for the BestBefore function represents localID.
localID is defined as – Optional (Default: 0, system locale will be used) This parameter specifies the locale used to show the date value.
Local is a designation used by Windows to indicate proper formatting for date, time and currency for each region of the world. Here is the excerpt from the CODESOFT help file.
United State has the local value of 1033 and Mexico has local value of 2058. When 0 is used in the function, it uses the value that is defined by Windows installation.
To test this, we execute the same function 3 different times with different setting for local
Upper(BestBefore(left({ExpiryDate},6) ,”yyyymm”,-0,”m”, 0,”mmm/yy”,0)) = APR/19
Upper(BestBefore(left({ExpiryDate},6) ,”yyyymm”,-0,”m”, 0,”mmm/yy”,1033)) =APR/19
Upper(BestBefore(left({ExpiryDate},6) ,”yyyymm”,-0,”m”, 0,”mmm/yy”,2058)) = APR./19
Solution
For label designs that will be use across several region in the world, it is best to specify the specific local. If you design the label in United States and want to have the labels printed exactly the same regardless of which country prints them, it is better to use 1033 instead of 0 for local.
An alternative solution is to use the ReplaceString function to remove ‘.’ from the month abbreviation.
replaceString («string», «old_string», «new_string»): Replaces all occurrences of a specified «old_string» in character string «string» with another specified «new_string». Example: Month = "AGO." (August in Spanish) ReplaceString (Month, ".", "") = AGO
Author
Related Articles
- Loftware Redirect Print to PDF action using multiple printer seats
- License is failed – TEKLYNX CENTRAL Error Message
- Loftware Web Designer vs Desktop Designer
- Loftware Workday API Splitting Print Jobs
- Planning a BarTender Server Migration and Upgrade – BarTender Instructions Article
- Deciding on an In-Place Upgrade, Test Server, or Migration – BarTender Reference Article