×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*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.

# Weekday Function2

## Weekday Function

(OP)
I am totally frustrated trying to use the weekday function in a statement thus:
Day% = Weekday(ThisMonth%/1/ ThisYear%)

I get Day% = 7 (should be 4) when ThisMonth% = 3 and ThisYear% = 2000 (values checked with Breakpoint on next line). What the #\$%@# gives with this thing?

(Have tried putting the date expression into a variant and then performing Weekday on variant, putting #'s outside the expression, using commas instead of /'s)

Any insight into this glitch will be greatly appreciated!

Jeff Roberts

### RE: Weekday Function

Try this,

Dim MyDate As Date
Dim MyWeekDay As Integer

MyDate = DateSerial(ThisYear%, ThisMonth%, 1)
MyWeekDay = Weekday(MyDate)

Hope this helps!

### RE: Weekday Function

(OP)
Thank you VB400--it works perfectly! (Why the heck didn't it work the other way???)

### RE: Weekday Function

Here's the reason it didn't work:

The expression

ThisMonth%/1/ ThisYear%

actually means ThisMonth divided by 1 divided by ThisYear.

To get the results you expected, you need to concatenate the values like this:

ThisMonth & "/1/" & ThisYear

nick bulka
nick@bulka.com

#### 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.

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!