Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Assign a number to a week day

Assign a number to a week day

Assign a number to a week day


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


WeekNumber = DatePart("ww", Date, 2, vbFirstFourDays)

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

end if

RE: Assign a number to a week day

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


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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close