LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Six months from now?

Is there a "canned" routine for Labview ( 2014)  to determine 6 months from a date entered or do you have to write your own?

The User wants to put in a date for calibration purposes and know when 6 months are up.

 

Thanks..

0 Kudos
Message 1 of 6
(2,921 Views)

Hi Clint,

 

good news: you can do simple math with timestamps!

So use a timestamp (like "today()") and add 180*86400 (days*seconds/day) to it. Display the result as timestamp:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,911 Views)

Of course if the running program is supposed to notify the user six month from now that a calibration is due, the last calibration date would need to be written to a file (or cloud location) so it survives reboots and program restarts. It would also need to check the file on restart, maybe the date has already been long passed due to downtime.

There is probably also an API to e.g. add the next calibration date to google calendar or similar.

0 Kudos
Message 3 of 6
(2,893 Views)

That's what I initially had.  They complained ( maybe I didn't explain well enough) that they want "6 months from the current date".  Not 180 days.  So 6 months from today April 12, 2017 would be October 12, 2017....Six months from October 12, 2017 would be April 12, 2018..etc. 

 

Thanks..

 

I do write to a text file the cal date then read it back when ( before) the Test is run.

0 Kudos
Message 4 of 6
(2,884 Views)

There are a pair of functions on the Timing Palette, Date/Time to Seconds and Seconds to Date/Time, that convert from LabVIEW's TimeStamp (here called "seconds") into a cluster they call a "Date/Time Record", which has numeric fields for Month, Day, Year, and a bunch of other things.  So you can take a TimeStamp for Today (the default, "unwired" output of Get Date/Time in Seconds), do Seconds to Date/Time, add 6 to the Month part of the Cluster, run it through Date/Time to Seconds, and have a TimeStamp for "six months from now".

 

By giving you "100 words" instead of a Picture, I'm hoping you'll try this and learn about these functions.  Use "Help" if you need to on the functions.

 

Bob Schor

0 Kudos
Message 5 of 6
(2,874 Views)

@Bob_Schor wrote:

 add 6 to the Month part of the Cluster, ...

 


Most easily done using the "in place element structure". :D)

0 Kudos
Message 6 of 6
(2,853 Views)