HazMatt Posted September 17, 2003 Posted September 17, 2003 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?
LiveOak Posted September 17, 2003 Posted September 17, 2003 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
Jim McKee Posted September 17, 2003 Posted September 17, 2003 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? 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!
HazMatt Posted September 17, 2003 Author Posted September 17, 2003 Yes! Sometimes you have to think outside the box, I guess. Thanks, I learned a small tidbit from all three replies.
-Queue- Posted September 17, 2003 Posted September 17, 2003 Simplified again, make Day(1) 1 and Day(1) - 1 0.
Recommended Posts
This topic is 7989 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 accountSign in
Already have an account? Sign in here.
Sign In Now