471,321 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

Calculate first and last day of week

How do I get the date for the first and last day of the week, and the first and last day of last week?
Feb 15 '08 #1
3 29648
cori25
83
• The first day of the current week (assuming Sunday = day 1):
Date() - WeekDay(Date()) + 1

• The last day of the current week:
Date() - WeekDay(Date()) + 7
Feb 15 '08 #2
missinglinq
3,532 Expert 2GB
FirstDayOfCurrentWeek = SomeDate-(weekday(SomeDate)-1)
FirstDayOfPreviousWeek = SomeDate-(weekday(SomeDate)-1)-7

LastDayOfCurrentWeek = SomeDate - Weekday(SomeDate) + 7
LastDayOfPreviousWeek = SomeDate - Weekday(SomeDate)

You can enter an actual date for SomeDate or use Date() to base this on today when run.

Welcome to TheScripts!

Linq ;0)>
Feb 15 '08 #3
ahmadMBAAAA
1 Bit
Hi, can you help me here, I'm trying to start the same one but with start day next Sunday and the end date end next week on Saturday in the format of dd.mm.yyyy. As I'm connecting this to sap script.

Can you assist here?
1 Week Ago #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Hardy Wang | last post: by
2 posts views Thread by Rustan | last post: by
reply views Thread by bdtmike | last post: by
10 posts views Thread by sherifffruitfly | last post: by
2 posts views Thread by Janick Bernet | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.