Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First day of the week?

Status
Not open for further replies.

tiramisu01

Programmer
Feb 11, 2000
19
SG
<br>
Is there a function to determine the date of the first day of the week given the current date? If there isn't, does someone has a code for this? Thanx. 8) <p>Jasper<br><a href=mailto:tiramisu01@hotmail.com>tiramisu01@hotmail.com</a><br><a href= > </a><br>
 
This seems to work, assuming the first day of the week is Sunday (if you don't want to do it for the current day, replace 'date' with the date desired):<br>
<br>
Dim theday<br>
Dim firstday<br>
Dim thedate<br>
thedate = date<br>
theday = Weekday(thedate)<br>
firstday = theday - 1<br>
response.write DateAdd(&quot;d&quot;, firstday * -1, thedate)<br>
<br>
<p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Hey Nic, thanx. Works like magic. 8) <p>Jasper<br><a href=mailto:tiramisu01@hotmail.com>tiramisu01@hotmail.com</a><br><a href= > </a><br>
 
Glad I could help. <p>nick bulka<br><a href=mailto:nick@bulka.com>nick@bulka.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top