January 20, 201114 yr In my babyparking i've 2 cards, one of 30 hours, one of 50 hours. The 30 hours card expire after 5 month. The 50 hours card expire after 10 month. I need to calculate the expiration date jumping the summer's month, july and august. So if you buy a 50 hours card in may, i must calculate the expiration date adding may, june, september, october, november, december, january, february, march, april (10 month). I've a creation date field obviously, but i can't figure out how to make a calculation like that. Over this i must add the year of expiration if i pass december like the example above. Thankyou! G.
January 21, 201114 yr Try (untested) = Let ( [ m = Month ( IssueDate ) ; diff = Mod ( m - 9 ; 12 ) + Duration ; yDiff = Div ( diff ; 10 ) ; mDiff= Mod ( diff ; 10 ) ] ; Date ( 9 + mDiff ; Day ( IssueDate ) ; Year ( IssueDate ) - ( m < 9 ) + yDiff ) ) where Duration is the number of months (either 5 or 10, in your example). Note that this assumes no cards are issued in July or in August.
January 21, 201114 yr Author A W E S O M E. I'm not a programmer but i'm fascinated by this logics. Thank you, you've save us a lot of problem. :)
Create an account or sign in to comment