Overview
A sample VI for converting a Time Stamp from Locale time (local computer time zone time) to Coordinated Universal Time (UTC) and vice versa
Description
Use this VI example to understand methods for inter-changing timestamps between Locale and UTC.
Note: The Time Stamp format does not contain locale information and must be interpreted as UTC or Locale as appropriate.
Note: Daylight Savings Time (DST) is automatically considered as a part of the Local settings
Note: Changes to the Windows Time Zone settings will only be recognized by LabVIEW following a restart.
Steps to Complete
1. Launch the VI "Local-UTC Time Conversion_LV2012_NI Verified"
2. Choose the local time and time in UTC that you want to convert
3. Run the VI
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.
Can we get a 8.6 or older version for the old guyes
I am sorry but I am working with 7.1 version. Can you get al block picture from the vi.
Thank you
Thank you sir ! !
The format string in Scan From String is incorrect. The function will return an error if the time difference is negative. Replacing with %3d:%2d:%2d works fine
Thank you
Warning! This only works for converting timestamps with the same DST status as the current time. "Difference between UTC and locale" and "Locale time shift date time record" are correct only if the "Locale Time Stamp" input timestamp has the same DST status as the current time.
Fix: the "Locale >> UTC" section should have a True into the Seconds to DateTime function and it not subtract anything from the time record.
Since developing this over two years ago I've encountered a couple of scenarios whereby these functions are incorrect. I can't recall the specific scenarios but I suspect that which you've identified StephenGerads is one of them. Time conversion from one time zone/DST period to another is a tricky business!
This method seems to work well to get a locale timestamp