LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Text const to a timestamp

Solved!
Go to solution

Is there a way to do the following

LED47_0-1779563411645.pngFrom text constant and convert that directly into a timestamp that I can use for the X axis for a graph?

 

0 Kudos
Message 1 of 4
(78 Views)
Solution
Accepted by topic author LED47

Hi LED47,

 

Use "Scan From String" with a timestamp format specifier:

 

raphschru_1-1779570636324.png

 

When parsing only a date (without time), LabVIEW adds 1 hour for some reason, so if you want midnight (start of the day), just add a zero for the hours.

 

Question: Are you sure your input will only contain the date, and not also the time (such as for example "8:45:12.123")?

Parsing a date-only string as a timestamp and using it for the X axis of a graph seems very unusual.

 

Regards,

Raphaël.

Message 2 of 4
(42 Views)
Solution
Accepted by topic author LED47

Kudos to @raphschru!

 

Yes, the peculiarity of dealing with TimeStamps in "Human-readable Formats" drove me crazy when I tried to record EEG-like signals in a study a decade or so ago.

 

Unfortunately, I don't have the code handy to see how I managed to get things working.  I do remember being at an NI Week meeting with my laptop, and noticing my test runs were 1 hour off -- I happened to be at NI Week (so you know it's at least 6-8 years ago), and forgot that Texas is in a different time zone from where the data were acquired, so the "hours" were off by one.

 

Bob Schor

0 Kudos
Message 3 of 4
(24 Views)

 Seek and you shall find, thank you very much perfect

0 Kudos
Message 4 of 4
(16 Views)