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.

Date calculation

Featured Replies

  • Newbies

Hi, I am completely new to Filemaker. I work on a database for timesheets to calculate hours worked by employee to calculate their wages. But the wages are paid not per calendar month, but a payroll month. Payroll month starts on a Sunday before last Thursday of the previous month and ends on a Saturday before last Thursday of the month.

How do I calculate a payroll month for a timesheet date?

Thanks

This should get you started: the date of the Sunday before last Thursday of the previous month for any given date can be calculated as =

Let (
firstOfMonth = Date ( Month (  GivenDate ) ; 1 ; Year ( GivenDate ) )
;
firstOfMonth + Mod ( 5 - DayofWeek ( firstOfMonth ) ; 7 ) - 11
)

Be sure that the result of the calculation is Date.

On second thought, to simplify the matter one should calculate the date of the Sunday before last Thursday of this month instead. Then, if the given date is before that date, it belong to this month - otherwise it belongs to the next month. So cPayrollMonth =

Let ( [
firstOfNextMonth = Date ( Month (  GivenDate ) + 1 ; 1 ; Year ( GivenDate ) ) ;
lastSun = firstOfNextMonth + Mod ( 5 - DayofWeek ( firstOfNextMonth ) ; 7 ) - 11
] ;
Case (
GivenDate < lastSun ; Date ( Month (  GivenDate )  ; 1 ; Year ( GivenDate ) ) ;
firstOfNextMonth
)
)

This returns the date of the 1st of the month to which the given date belongs. This type of result is most convenient for sorting and grouping - and you can format it to display as May 2014, for example, without affecting the sort.

  • Author
  • Newbies

Comment, thanks, that worked.

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.