LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The "Date/Time to Seconds" function isn't working as I expect. Can anyone tell me why?

Solved!
Go to solution

In the attached VI my hour input to the "Date/Time to Seconds" function is 11, yet the ouput is 12:09. Why is it 12:09 and not 11:09?

 

Thank you.

0 Kudos
Message 1 of 15
(3,800 Views)

Daylight savings time?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 15
(3,796 Views)

Is there an easy way to account for Daylight Savings Time when using this function other than looking at the month and day of the year and making adjustments as required?

 

Thank you.

0 Kudos
Message 3 of 15
(3,790 Views)

Pull your cluster down by one more and Select Item > Numeric 10. Set that to -1.

 

 

Message Edited by Broken Arrow on 05-14-2010 01:20 PM
Richard






Message 4 of 15
(3,783 Views)

I just looked at the detailed help on this function.  It does convert to the local time zone for your computer.  So it adjusts for DST.  I don't think it should if you have a cluster wired in.  If you wire in 11:00, it should otuput 11:00. 

 

The help says that it converts a cluster of time values into a timestamp measured as the number of seconds since blah blah blah.  But if you wire in a date time rec cluster, it doesn't output the number of seconds since blah, it outputs a timestamp of the cluster you wired in.  This function is misnamed and its help is ambiguous, if not just plain wrong. 

 

It really does not convert Date/Time to Seconds.  Its output is a timestamp, not the number of seconds since blah.  The number of seconds since blah would be a large integer, like 3,456,789 or something.  The output is not an integer, it is a timestamp.  So the name is very misleading. 

 

Also if you do not wire in the cluster, you will get a timestamp of the current time, but if you wire in a cluster, you get a timestamp of the time described by the cluster.  The help screen does not mention this at all.

 

Message Edited by tbob on 05-14-2010 11:16 AM
- tbob

Inventor of the WORM Global
Message 5 of 15
(3,781 Views)

chuck72352 wrote:

Is there an easy way to account for Daylight Savings Time when using this function other than looking at the month and day of the year and making adjustments as required?

 

Thank you.


 

ASide from using the inverse function to test the date, I think not.

 

THe rules about DST are dicated by US govt law and as such it is arbitrary and can change any time the politicians change their mind.

 

So it is actually implmented in the OS.

 

I would love to hear about an easier way.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 15
(3,776 Views)
I tried that and it works, but I have no idea why or how it works.
0 Kudos
Message 7 of 15
(3,764 Views)
Solution
Accepted by topic author chuck72352

chuck72352 wrote:
I tried that and it works, but I have no idea why or how it works.
Tried which idea? If you are talking about my idea above, position 10 in the Cluster is "is DST", look at the help. The only way to make it make sense would be to name the cluster elements properly, as NI should have done, so the names will get propigated to the Unbundle.
Richard






Message 8 of 15
(3,753 Views)

I'm beginning to like the tags. I recalled a DST issue that I commented in:

 

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=414604

 

James Hillman (used to be NI?) provides some thoughts...


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 9 of 15
(3,742 Views)
Thank you!  That makes it clearer.
0 Kudos
Message 10 of 15
(3,733 Views)