Jump to content

function from number to month


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

Recommended Posts

I am trying to flag an event every quarter.

Filemaker finds the most recent event using max function and using month function calculatest the month. eg 6/10/05 becomes june or 6. Now I want to add 3 months and get 9. Can I convert the 9 back to september with a function or do I need to lookup a table of months and numbers 1 jan 2 feb etc.

Link to comment
Share on other sites

How about:

Choose(theField, "", "January", "February", "March", "April", "May", "June", "July", "August", "September", "November", "December")

Remember that the Choose function is 0-based so we need a blank "" for the 1st choose option.

Or you could probably just leave the calc field (+3) as Date type and use "Month(originalDate) + 3". Format the field on the layout to display the month name.

Link to comment
Share on other sites

I am not sure what your question is. If you want to compute a date 3 months later then someDate, you can use:

Date ( Month ( someDate ) + 3 ; Day ( someDate ) ; Year ( someDate ) )

The result should be a Date, and you can format the display any way you like, including just the name of month. To extract the name of the month as text, use the MonthName() function.

Note that the above calc rolls over to the next month if the new month is too short, e.g. 3 months from November 30 is March 2.

To convert n (a number from 1 to 12) to the corresponding month's name, try:

MonthName ( Date ( n ; 1 ; 1 ) )

This also rolls over if n > 12, e.g. n=13 returns "January".

Link to comment
Share on other sites

To clarify, what I was trying to avoid was months that are too short leading to errors. I don't want to add 90 days to November 30 as this could become March instead of Feb (since the month is short). That is why I wanted to extract the month and add 3 months and then convert back to the name for the report. People like to see sept not 9 on the printout. You have both given me some ways to approach this. Thank you.

Link to comment
Share on other sites

This topic is 5657 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.