Jump to content

Expiration date calculation, jumping summer's months.


This topic is 4400 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 4400 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.