04-01-2009 09:34 AM
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:
Solved! Go to Solution.
04-01-2009 10:11 AM

04-01-2009 10:39 AM - edited 04-01-2009 10:40 AM
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.


04-01-2009 10:41 AM
04-01-2009 10:51 AM - edited 04-01-2009 10:52 AM
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.
