LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time Stamp format from file problem

Solved!
Go to solution

Hey there,

 

I have a pretty peculiar problem. I'm working on two PCs right now, one is my private laptop running on Windows 8, and the other one the PC at my workplace, running on Windows XP, but on the same version of LabVIEW. I use this method to save the time and date to a tab delimited .txt file. Then later, with another VI, I read the date and time written to file to reconstruct the time stamp. I've noticed that dates written to file from my workplace differ from the dates written from my private PC: in Windows XP, there are "-" separating the day, month and year. In Windows 8, it's "/". There are other differences (see pictures). So naturally, when reading from file using my VI, I can only read on my private PC files (or at least dates) written on my private PC and vice versa, I can't read files written on my private PC on my workplace PC. Can anybody tell me why there's a difference in format, or how to write the date uniformly so I can read it on any PC, or how to read both formats?

 

So this is the method I use for writing the time and date (the subVI only inserts a certain number of TAB characters).

Time Stamp.jpg

 

This is what it looks like on Windows 8

Date for W8.jpg

This is what it looks like on Windows XP

Date for XP.jpg

This is the VI (attached) I use to read the time stamps (the first row actually contains the time stamp in HH:MM: SS format for a whole bunch of measurements).

 

Extract Time Stamps.jpg

 

Have a nice day.

0 Kudos
Message 1 of 3
(3,162 Views)
Solution
Accepted by topic author Leukocyte

Hi Leykocyte,

 

two comments:

1. The difference in timestamp format is originated in the local PC "regional settings" regarding timestamp formats - set the same regional settings for all computers/accounts. And it is originated in your LabVIEW routine as you use the local timestamp format of the PC. Better solution to save formatted timestamps (atleast from programmer point of view): use a fixed timestamp format like %Y%m%d-%H%M%S…

 

2. When reading the timestamps you need to program some more checks. Reading the values could be done with a format string like "%d%1s%d%1s%d" (for the date part) - but don't forget to check for year values like "15" vs "2015"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(3,142 Views)

I would suggest using the ISO-8601 UTC format.

 

The only limitation is that the string value is in reference to GMT.

 

The conversion of the string back to a timestamp will present the date/time on your front panel indicator as local time.

 

https://lavag.org/topic/15034-timestamp-support-for-format-into-string-scan-variant-from-string-stri...

 

 

 


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 3 of 3
(3,106 Views)