pbucc Posted February 13, 2002 Posted February 13, 2002 hi there i just did to calculate a simple payroll date. what ever date you enter it needs to go back to the monday of that week.
Vaughan Posted February 14, 2002 Posted February 14, 2002 Monday is the second day of the week. Work out what the day-of-week of the date is (using the DayOfWeek function) subtract it from the date, then add 2 to it. It could be written as... Date - DayofWeek(Date) + 2 If the date is a Sunday the calculation will return the folling day as the Monday date. Cool. And I make it look sooooo easy! PS the DayOfWeek function returns 1 for Sunday and 7 for Saturday, at least for the US/English/Australian version I use. This calculation may break for other localised versions (like Sweden?) that start their week on Monday -- I cannot test it so I don't know, but be aware.
Recommended Posts
This topic is 8318 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