LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

updating Date

Solved!
Go to solution

I am have been trying to get this date function's logic working and I just can't get the right configuration what it needs to do is add two days on to the original date the user enters in the logics that need to be worked out are if the month is almost over either 28, 29, 30, 31 it needs to go to the next month and add another day for instance if i enter in 1 31 2009 it should update to 2 2 2009 and also if it is 12 31 2008 it needs to shift to 1 2 2009

 

if anyone could help I would be thankful:

here is the code i have so far: 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 1 of 5
(3,480 Views)
I can't look at your code at the moment, don't have 8.6 installed on this machine (please identify the version of vi's posted), but will offer some suggestions. The first problem is identifying "the end of the month" since this varies from 28 days to 31 days, with the obvious varient of leap years. Reading the current date, parsing by month and identifying the end of the month, then adding two days. Time is measured in LabVIEW as seconds since 1/1/1904 so adding two day's worth of seconds (172800) to the current seconds count would give you a time stamp two days hence.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 5
(3,466 Views)

There's nothing in your code.  Instaed of using individual numbers, you can use a timestamp which will give your uses access to the calendar selection as well.  If you don't want to use the timstamp, method 2 in the attached VI will still work.

 

I attached a VI with two methods of doing it.  I used the timestamp, becuase it is much simpler.  Method one, you just convert it to a double and add 2 days worth of seconds to it, then convert it back to the timestamp.  Method two converts the timestamp into a cluster with information about the date.  I just add 2 days to the day of the month.  In both cases, converting it back to the timestamp automatically figures out any month or year roll overs for you.

 

 

 

 

Message Edited by Matthew Kelton on 04-01-2009 11:40 AM
Download All
0 Kudos
Message 3 of 5
(3,457 Views)
I  must have sent the wrong one but I actually need it to be with the three seperate numerated controls.
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 4 of 5
(3,454 Views)
Solution
Accepted by topic author Harold_Timmis

As I said in my other response, you can basically use parts of method 2 to accomplish this as well.  The attached VI has it broken into d/m/y.  I create a timestamp after adding 2 days, then convert it back to the cluster to pass out the information.

 

If you don't want to do it this way, you'll need to write the logic which adds the two days and takes into account end of year, leap years, # of days in the month, etc.

 

 

 

Message Edited by Matthew Kelton on 04-01-2009 11:52 AM
Download All
Message 5 of 5
(3,446 Views)