April 23, 200322 yr On a form that a user will enter a date range for a report, I have provided 2 convenience buttons to pre-fill the start/end dates for the current month and the current week. I had no problems with the month, but I am having trouble with the week. I'm sure somebody has done this before. I just need to calculate the dates (mm/dd/yyy) for the first and last day of the current week (Sun and Sat). Does anyone have this handy?
April 23, 200322 yr The function Day(date) returns a number depending on which day of the week it is -- I think (and I haven't checked this in a while) it returns a 0 for Sunday, 1 for Monday, etc. In any event, you can use this function to calculate the actual dates you want.
April 23, 200322 yr Author I get the following: Date for Start of week: Date( Month(Today), Day(Today) - (7-DayofWeek(Today)) , Year(Today)) Date for End of week: Date( Month(Today), Day(Today) + (7-DayofWeek(Today)) , Year(Today)) Seems to work. Does anyone see any problems with this?
April 23, 200322 yr Don't use the Today function. It only gets updated when the file is opened and if it is used in several records, it will take longer to open the file while it calculates the date. Use the Status(CurrentDate) function instead. HTH, Mike
April 23, 200322 yr Hi, Second time this week ThisWeek'sSunday = Status(currentdate) - MOD(DayofWeek(Status(currentdate)) +7-1; 7) will return the 1st day (Sunday) of current week ThisWeek'sSaturday = Status(currentdate) + MOD(7-DayofWeek(Status(currentdate)); 7) will return the last day (Saturdat) of current week
April 23, 200322 yr Author Thank you! I'm sure you meant commas (,) where you have semi-colons in the formulas.
April 23, 200322 yr Sure, French Copy/Paste formulae. I'll surely find my way through this problem for future posts. WHY DOESN'T FM USE THE SAME SYNTW FOR THE WHOLE WORLD ? I did keep the +7-1 syntax, that could oviously stand as 6. For those who are interrested, just change +7-1 to +7-2, +7-3, to see the results...for Monday, Tuesday,...
April 23, 200322 yr FM doesn't use the same punctuation worldwide because the world doesn't use the same punctuation. When American English becomes the standard worldwide (you know, as soon as we finish "liberating" all the other countries who have no weapons of mass destruction), then we'll all use the same system, and so much for the Tower of Babel.
April 23, 200322 yr Oh yes, Then we'll finally also have our " 's " and " s' " at end of our names in order to use Cobalt Sky technique
Create an account or sign in to comment