LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format Date/Time String

Hi,

I am using  a 'Format Date/Time String' function to convert a timestamp obtained from 'Get Date/Time In Seconds ' in an RT target. The converted value lags the original time stamp by excatly one hour. Why is this so? Is there a way to correct this?

Thanks in advance

Best Regards,

Anurag

0 Kudos
Message 1 of 12
(1,856 Views)

It's caused by the Daylight Saving Time. You can turn it on/off as in this snippet (maybe there's a better way)

 

DST onOff.png

 

Ben64

 

Message 2 of 12
(1,833 Views)

Make sure the timezone of your RT target is configured the same as your host system!

 

There is no simple solution otherwise. The easiest would be to lobby for the views of the Flat Earth Society to be recognized as valid all around the globe 😀 and abandon timezones althogether. Unfortunately and very surprisingly, there seem to be quite a few countries who seem not very happy to change their timezones to be a different one than what they are using now! 😎

Rolf Kalbermatter
My Blog
Message 3 of 12
(1,832 Views)

Your conversion from timestamp to string is missing the year.

 

So it probably isn't calculating DST because without the year, it won't know if a specific month and day would be a part of daylight savings time or not.

Message 4 of 12
(1,803 Views)

A common tip/solution is to use Universal time zone, there's a boolean input for that. That way you'll avoid the issues that often happens if the system is running as daylight savings is (de)activated.

That won't fix your current issue, but you can set your computer to UTC or convert it as you look at the data.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 5 of 12
(1,800 Views)

The problem persists, when the time stamp is fed to Format Date/Time String the output of it is 1 hour delayed. 😕

 

0 Kudos
Message 6 of 12
(1,789 Views)

The use of UTC wont fit my need as I need the time resolution of at least 4 decimals of partial seconds.

0 Kudos
Message 7 of 12
(1,785 Views)

@Anurag_NI wrote:

The use of UTC wont fit my need as I need the time resolution of at least 4 decimals of partial seconds.


UTC is a timezone and has nothing to do with resolution.  One of the beauties of UTC is that is does not do Daylight Savings.  So I am a fan of using UTC.


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
Message 8 of 12
(1,777 Views)

Check the Time Zone settings as this works fine for me...

 

Time-Capture.PNG

========================
=== Engineer Ambiguously ===
========================
Message 9 of 12
(1,758 Views)

I would use UTC internally, and only convert when a human needs to look at it.  This would avoid potential issues with gaps in data (spring forward) or overwritten data (fall back).

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 10 of 12
(1,736 Views)