LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format Date/Time and different regions

Solved!
Go to solution

I am developing an application here in the US on English LV2009 software.  This application will be installed in multiple areas around the world and I just came across an issue with date/time that I'm trying to figure out.  Attached is a screenshot of the application running on a Chinese computer.  In the upper right there is a "Results Save Location" that has a month and year appended to the filename.  I'm using the format date/time with modifiers for month name and 4-digit year (%B %Y).  On my PC it shows as July 2010, but on the Chinese computer it shows 7 01.  Also, the reason it says bad serial number is that I'm comparing the SN to the 2-digit year and it seems to grab it incorrectly.

 

On my PC, I tried changing my date settings in Windows and it doesn't seem to affect the output like it does on the Chinese computer.  I know there is a UTC boolean selector that can be enabled.  Will that make a difference in how the date is displayed from this function?

 

This is one of a few issues I have come across when developing a program for multiple regions, but it is currently the only one I haven't solved yet.

Download All
0 Kudos
Message 1 of 5
(3,110 Views)

I don't have LV 2009 installed, so I can't open your VI.

 

I'm guessing that you are using the Format Date/Time String function to name your file. If you do not specify a time format string, the default value is %c (locale specific).

 

To make your filename more universal, use a string format of

 

[%Y_%m_%d][%H_%M_%S]

 

UTC format to TRUE so that the time will always reflect a common reference.

 

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 2 of 5
(3,101 Views)

Thanks for the reply.  I don't need the actual time, just year and month so I was using %Y and %B respectively as the format.  Will UTC affect how the date displays though?  I would have thought a format of %B (month name) would give you the name of month regardless of locale.

0 Kudos
Message 3 of 5
(3,095 Views)
Solution
Accepted by Jshu23

I would expect month name to be langauge specific.

 

For example, the word April in French is Avril and is abbreviated Avr. I would use a number rather than the name.

 

The Thai calendar is +543 years compared to the western calendar, so a Thai PC could show a locale specific date of 2553-07-13. Your computer might show 7/13/2010. I'm quite sure that the Chinese calendar year is different than the western calendar.

 

Using UTC should force LabVIEW to use the Gregorian calendar based on the standard ISO-8601.

 

Considering that your users are working with technology and would probably recognize a Gregorian year/month/day combo I would stick with %Y_%m_%d. and UTC = TRUE.

 

I contributed a VI to the NI Community that you could use if you like; it has lots of options and is based on ISO-8601

.

http://decibel.ni.com/content/docs/DOC-7199


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 4 of 5
(3,085 Views)

Thanks for your input.

0 Kudos
Message 5 of 5
(3,068 Views)