# Beginning of week calculation

Sorry,

I'm doing this in report builder.

Thanks,
Jasper

-----Original Message-----
From: Mark Wonsil [mailto:mark_wonsil@...]
Sent: Wednesday, April 18, 2007 9:48 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Beginning of week calculation

Hi Jasper,

> Does anybody know how I can calculate the beginning date of every week? Our
> week starts on Sunday so I want the date for every Sunday of the year.

You didn't mention version or programming language but the general rule I use
is to utilize the DayOfWeek function in your language of choice (DOW for
VB.Net, not sure the Progress equivalent). This function returns the day of
the week, usually 0 for Sunday, 1 for Monday, etc. You can then subtract the
Day of Week number from your date to get Sunday. Depending on your system
settings, DOW may return 0 for Monday, so make the necessary adjustments.

Mark W.

[Non-text portions of this message have been removed]
Does anybody know how I can calculate the beginning date of every week? Our week starts on Sunday so I want the date for every Sunday of the year.

I have the calculations for the current week, I just need to know how to figure out the beginning date of the week.

Thanks,
Jasper

[Non-text portions of this message have been removed]
Here's a basic algorithm I wrote for a payroll report to calculate the
beginning and end of last week:

Day = today - 7

Do while day <> Sunday
Day = Day -1
End

BeginLastWeek = Day
EndLastWeek = Day + 6

________________________________

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Jasper Recto
Sent: Wednesday, April 18, 2007 9:17 AM
To: Vantage Groups (E-mail)
Subject: [Vantage] Beginning of week calculation

Does anybody know how I can calculate the beginning date of every week?
Our week starts on Sunday so I want the date for every Sunday of the
year.

I have the calculations for the current week, I just need to know how to
figure out the beginning date of the week.

Thanks,
Jasper

[Non-text portions of this message have been removed]

This is an e-mail from Saab Barracuda LLC. It is for the intended recipient only and may contain confidential and privileged information. No one else may read, print, store, copy, forward or act in reliance on it or its attachments. If you are not the intended recipient, please return this message to the sender and delete the message and any attachments from your computer. Your cooperation is appreciated.

###########################################

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.

[Non-text portions of this message have been removed]
Hi Jasper,

> Does anybody know how I can calculate the beginning date of every week? Our
> week starts on Sunday so I want the date for every Sunday of the year.

You didn't mention version or programming language but the general rule I use
is to utilize the DayOfWeek function in your language of choice (DOW for
VB.Net, not sure the Progress equivalent). This function returns the day of
the week, usually 0 for Sunday, 1 for Monday, etc. You can then subtract the
Day of Week number from your date to get Sunday. Depending on your system
settings, DOW may return 0 for Monday, so make the necessary adjustments.

Mark W.