07-02-2013 01:32 PM
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.
07-02-2013 02:50 PM
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
07-02-2013 05:27 PM
Set the "Is UTC" boolean input on the Date/Time to Seconds function to TRUE. It will then ignore the DST input.
07-03-2013 08:36 AM
I already tried the Is UTC input and it changes the time for me too, because I'm in the eastern time zone.
07-03-2013 08:52 AM - edited 07-03-2013 08:54 AM
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!
07-03-2013 08:56 AM - edited 07-03-2013 08:57 AM
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.
07-03-2013 11:30 AM
Ok, thanks. I'll have to try that when I get a few minutes.