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

Assign a number to a week day

Status
Not open for further replies.

evr72

MIS
Dec 8, 2009
265
US
Hello,

I am trying to assign a number to the weeks and for the different days from Monday to Friday, then add both numbers

Here is what I have tried so far but no luck
Code:
WeekNumber = DatePart("ww", Date, 2, vbFirstFourDays)
Response.Write(WeekNumber)


weekNumber23 = WeekDayName(WeekDay(Date))
if weekNumber23= "Wednesday" then response.write(1)

end if
 
Not sure if this is what you are after. If you copy the code into a .vbs file and run it from the cmd prompt, it will be a lot easier to debug
Code:
WeekNumber = DatePart("ww", Date, vbMonday, vbFirstFourDays)
WScript.echo WeekNumber
DayNumber  = DatePart("w", Date, vbSunday, vbFirstFourDays)
WScript.echo DayNumber

WScript.echo WeekNumber * 5 + DayNumber
Then when you've got it right, change the WScript.echo to Response.Write and and put it in your web form
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top