Jump to content

date calculation troubles


arfus

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

Recommended Posts

i have created the following calculation -departure date = (Date ( departure month ; departure day ; departure year ))

however, what i get in return is always '12' for the month; the correct day; but always 1 year less than the entered year.

now, my months are entered as text, and so i know i need to do something radically different here, but do not know how to proceed (for other reasons, auto emails, etc, i need the month as text) -- i need help with this.

and then the year problem, just baffles me. for instance i enter 2008 in the year field, whch returns 12/01/2009 in the departure date field.

any help would be great!

Link to comment
Share on other sites

The Date() function expects a number for the month. When there's no number, the text evaluates as 0, which is the December of previous year.

It's preferable to enter the month as a number - or, even better, enter the date as date. It is both easier and less error-prone to translate a date to text format (e.g. using the MonthName function) then the other way around.

Link to comment
Share on other sites

Hi

there is something that isn't correct here...

You said: "but always 1 year less than the entered year" and after a while you said:

"for instance i enter 2008 in the year field, whch returns 12/01/2009 "

BTW FM7 is smart enought to calc the correct date, even if you set the calc as text result !

So, please, give us more informations about those fields (departure month ; departure day ; departure year )

Perhaps your "Departure month" contains the monthName ?

Link to comment
Share on other sites

If your "departure month" contains the name of the month, you can try this calc to get the number of the month:

Case(

MonthName ( Date ( 1 ; 1 ; 1 ) ) = departure month ; 1 ;

MonthName ( Date ( 2 ; 1 ; 1 ) ) = departure month ; 2 ;

MonthName ( Date ( 3 ; 1 ; 1 ) ) = departure month ; 3 ;

MonthName ( Date ( 4 ; 1 ; 1 ) ) = departure month ; 4 ;

MonthName ( Date ( 5 ; 1 ; 1 ) ) = departure month ; 5 ;

MonthName ( Date ( 6 ; 1 ; 1 ) ) = departure month ; 6 ;

MonthName ( Date ( 7 ; 1 ; 1 ) ) = departure month ; 7 ;

MonthName ( Date ( 8 ; 1 ; 1 ) ) = departure month ; 8 ;

MonthName ( Date ( 9 ; 1 ; 1 ) ) = departure month ; 9 ;

MonthName ( Date ( 10 ; 1 ; 1 ) ) = departure month ; 10 ;

MonthName ( Date ( 11 ; 1 ; 1 ) ) = departure month ; 11 ;

MonthName ( Date ( 12 ; 1 ; 1 ) ) = departure month ; 12 ;

"?"

)

Link to comment
Share on other sites

thank you raybaudi.

i did not get the last calculation to work but changed over to a full numeric system at your suggestion and things seem to be working now.

again thank you so much for your attention.

best arfus nyc

Link to comment
Share on other sites

This topic is 6623 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
×
×
  • Create New...

Important Information

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