To download NI software, including the products shown below, visit ni.com/downloads.
Overview:
This example converts a string in HH:MM:SS+UTC HH:MM format into a Time Stamp and outputs the difference with the current time in seconds.
Description:
The string is converted into a Time Stamp by using the Scan from String function. A format string specific to Time Stamps is used to make sure the string is properly converted into a Time Stamp. This format string can be found in the LabVIEW Help File for Scan from String. The date portion of the time stamp is extracted from the Get Date/Time in Seconds function.
Requirements:
LabVIEW 2012 (or compatible)
Steps to Implement or Execute Code:
Additional Information or References:
Block Diagram
Front Panel:
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
This will come in handy, thanks for saving me the time! Get it?
Hahaha! Saved me time too. Thanks!
I try to parse a string that contains a timezone in the format "%Y-%m-%dT%H:%M:%S_%z". Thus "2009-10-16T13:00:00_01:00:00" has the suffix for a UTC+1h timezone and represents 2009-10-16T12:00:00 in UTC.
But the Scan From String Function does not seem to care about the %z-value. If it is missing it gives no error and if it is present the timezone value does not affect the timestamp value (neither before or after conversion to double).
Is there any way to make LabVIEW 8.6 scan the timezone? I will try a manual workaround that parses the timezone separately.
Thanks.
Thank you!
thanks.. just what i was looking for..
There is an error in the example. If you are using a four digit year the format code must be upper case Y; %y should be %Y. Works very well. Thanks.