From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert the date and time difference from the current date and a selected date into seconds?

Solved!
Go to solution

Hi,

 

Im making a clock with an alarm, and i want to be able to set the date that the alarm will go off, however to do this i need to be able to convert the difference between the current date and the target date into seconds in order to be able to use it in the elapsed time vi. Does anyone know how to do this? Or is there a better way to achieve this?

 

Thanks

0 Kudos
Message 1 of 7
(2,991 Views)
Have you tried the subtract function? You are using timestamps, aren't you?
0 Kudos
Message 2 of 7
(2,989 Views)

Why do you need to use the Elsapsed Time function?  Just compare the current date/time to the alarm date/time.  Doing it this way will also allow you to save the alarm date/time to a file and you can shut down your program and come back 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 3 of 7
(2,984 Views)

How to i get a time stamp to automajically set itself to always be the current time?

0 Kudos
Message 4 of 7
(2,980 Views)
Solution
Accepted by topic author nickom

Hi nick,

 

you get a timestamp from GetTimeInSeconds

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 7
(2,976 Views)

Well i want it to have like the autoreset and stuff, that way i might try afterwards though, still getting used to it:)

0 Kudos
Message 6 of 7
(2,975 Views)

@nickom wrote:

How to i get a time stamp to automajically set itself to always be the current time?


I'm not sure if this is what you're looking for, but have you tried the "Get Date/Time In Seconds" VI?  I don't know how you're updating your clock, or at what frequency you require it to be updated, but if the update frequency you need isn't too high (say, <500 Hz) I don't see why putting the "Get Date/Time In Seconds" VI inside your update loop wouldn't work.

Message 7 of 7
(2,967 Views)