Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

30 days hath september...

I'm trying to figure out how to make my date range work. I want to find monthly reports. I've figured out the basic mechanism for getting a date range into a find script (using Insert Calculated Result, not Set Field), but I'm having trouble with the actual calculation.:

(Month(Status(CurrentDate)) - 1)

& "/" &

"1"

& "/" &

Year(Status(CurrentDate))

& "..." &

(Month(Status(CurrentDate)) - 1)

& "/" &

"31"

& "/" &

Year(Status(CurrentDate))

The problem is the month's ending date. Since they vary, I need to account for all possible months.

I also just realized that my script won't work in January. How can I make this work?

Posted

The easiest way to avoid having to figure out how many days in a month is to make the end date one day less than the first day of the next month:

Date(Month + 1, 1, Year) - 1

This backs up one day from the first day of the next month. This is just the concept, you will have to work out the actual formulas for your application.

-bd

Posted

MD ...

Begin Date:

Date(Month(Status(CurrentDate)) - 1, Day(1), Year(Status(CurrentDate)))

End Date:

Date(Month(Status(CurrentDate)), Day(1) - 1, Year(Status(CurrentDate)))

In the End Date formula, what you're going to get is "the first day of the current month - 1", or, in other words, "the last day of the previous month." Follow that? smile.gif

FileMaker is smart enough to handle the Month and Year bits of the calc when you have values like +1 or -1 or whatever in the Day argument. Filemaker also handles leap year issues within these date calcs.

Good luck!

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