Why Does the Date/Time Data Created in LabVIEW Have an Offset in DIAdem?

Updated Oct 30, 2018

Reported In

Software

  • DIAdem
  • LabVIEW

Issue Details

I created data in LabVIEW with an associated date/time channel, and saved them in TDM format. I then loaded this file in DIAdem 9. Why does the date/time channel have an offset in DIAdem?

Solution

LabVIEW saves date/time data according to Greenwich, UK, and DIAdem works with absolute times. If you create a LabVIEW file in TDM format in Austin, Texas, USA, which is GMT minus seven hours, and DIAdem reads the LabVIEW file, the following times appear:

LabVIEW writes: 06/24/2004 15:00:17.4800
DIAdem writes: 06/24/2004 22:00:17.4800

Use the following formula in a DIAdem script to have the same time in DIAdem and LabVIEW:

Time_Zone_Constant := 7
Call FormulaCalc("ch('DateTime_New') := 'DateTime' + 3600 * Time_Zone_Constant")
Call ChnPropSet("DateTime_New", "displaytype", "Time")


The first function calculates the offset, with 3600 as the number of seconds in an hour, and 7 as the time shift in hours. (DIAdem calculates date/time data as the number of seconds that have elapsed since the year zero.) DIAdem adds an amount for negative time shift and subtracts an amount for positive time shift.

When the calculation is complete, the second function resets the display type from the numeric display to the time display.

Additional Information

This function is for GMT -7 and will not produce the expected behavior if you are in a different time zone. You will need to set the Time_Zone_Constant to the corresponding time zone value. You can find this the following equation.
Time_Zone_Constant := (-1) * (Offset from GMT time)

WAS THIS ARTICLE HELPFUL?

Not Helpful