Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dates for First and last Day of current week

Featured Replies

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?

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.

  • 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?

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

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

  • Author

Thank you!

I'm sure you meant commas (,) where you have semi-colons in the formulas.

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

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.

Oh yes,

Then we'll finally also have our " 's " and " s' " at end of our names in order to use Cobalt Sky technique cool.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.