LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Date Time adds an hour for Daylight Savings

Hi,

I'm using LV 2010 and have an issue with the "Date/Time To Seconds" vi.  See attached.  The application is interfacing to a hardware device that has a built in clock.  I'm writing a GUI program to set up the hardware.  When I read and display the date/time values inside the hardware, I want LV to display exactly what's in the device.  I don't want LV to make any changes based on daylight saving time or for any other reason.  Just report the time as it is.  The way this is coded, it is automatically adding an hour if I set the DST to 0.  I believe this is because LV says to itself, the time presented is not DST, but the PC is DST, so add an hour to make the presented time DST.  If I make it 1, as shown, it displays correctly, but when we go back to standard time, it will subract an hour.  This is annoying as daylight or standard times don't play into this at all.  Aside from testing the PC to see if the time is standard or daylight savings time, is there a way to make it just convert the time without "helping" me?

Thanks.

 

0 Kudos
Message 1 of 7
(3,464 Views)

Actually thats windows "Helping" you.  LabVIEW defaults to "System Time" Format.  You can change your indicators to NOT use system format using the advanced format editor of the property pages


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(3,440 Views)

Set the "Is UTC" boolean input on the Date/Time to Seconds function to TRUE.  It will then ignore the DST input.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(3,425 Views)

I already tried the Is UTC input and it changes the time for me too, because I'm in the eastern time zone.

0 Kudos
Message 4 of 7
(3,406 Views)

You have to understand how timestamps work. A LabVIEW timestamp stores internally ALWAYS the UTC time. But the Timestamp display displays by default always the local time. So the Date/Time To Seconds attempts to convert whatever you input into it to UTC based on the information of DST and isUTC that you provide.

 

Then the Timestamp display displays the data in your local timezone. There is a timestamp formatting in recent LabVIEW versions that allows to display UTC but it is not easily selectable in the Display Format settings of a Timestamp. However you can do it!

 

Go into the Display Format dialog of your Timestamp Indicator and switch from "Default editing mode" to "Advanced editing mode". Then make sure you display the "Absolute time format codes" in the list and from there look at "Universal time container". You'll see that the caret ^ character placed after the first percentage sign will instruct LabVIEW to display UTC  instead of the local timezone. So go into the "Format string" text box above and add the caret between the first percentage sign and the pointy bracket. Et voila!

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 7
(3,399 Views)

Ok, played around a little bit and here's what I found.  You need to change the display format of your TimeStamp indicator.  Use the Advanced Editing Mode and put in %^<%H:%M:%S>T

 

That ^<...> makes it use the Universal Time instead of your system time.

 

EDIT: Looks like Rolf beat me to it.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(3,392 Views)

Ok, thanks.  I'll have to try that when I get a few minutes.

0 Kudos
Message 7 of 7
(3,373 Views)