# 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.

##### 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.

##### Share on other sites

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.

:)

##### Share on other sites

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

## Create an account

Register a new account