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

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

Recommended Posts

Posted

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?

Posted

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.

Posted

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?

Posted

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

Posted

Hi,

Second time this week wink.gif

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

Posted

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,...

Posted

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.

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