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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get date of this week's Saturday

Status
Not open for further replies.

bjzielinski

IS-IT--Management
Nov 8, 2001
93
US
I want to produce a chart that shows each of our systems status and scheduled downtimes. It isn't realtime, I manually enter in data if a system is/will be down for some time. One machine is scheduled down every Saturday morning. I want to produce the date of the coming Saturday from when the script is run. Today (11/06/2002) the result should be 11/09/2002. I thought about getting it from using the week number somehow, but I don't know where to go from there. Any ideas? Bill Zielinski
bzielinski@co.midland.mi.us
County of Midland, Michigan
 
You can take the number of the day of the week and then add the appropriate number of days to come up with Saturday. This assumes Sunday = 1 and Saturday = 7.
Code:
dim nDayOfWeek
'Get the day of the week ordinal.  Sunday = 1, Saturday = 7
nDayOfWeek = weekday(now())
If nDayOfWeek < 7 then
	Response.Write &quot;Saturday is: &quot; & DateAdd(&quot;d&quot;, 7 - nDayOfWeek, now())
else
	Response.Write &quot;Saturday is:&quot; & now()
end if

You will probably want to play with the format of the date to your liking.

Thanks,

Gabe
 
Thanks Gabe, worked like a charm. Bill Zielinski
bzielinski@co.midland.mi.us
County of Midland, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top