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

produce day of week from date 1

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
is their a function that I can use to get the day of week based on a date?

Example:

I input 6/29/2006 and it would say Thursday

NameOfFunction(6/29/2006)

If not how would I go about creating such a function??



Newbie in search of knowledge
 
Format(#6/29/2006#,"dddd")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I tried

Code:
weekday(6/29/2006)


but it produced 7 which stands for Saturday

but when I put
Code:
weekday(6/29/2006,vbTuesday)

it gives me 5 which stands for Thursday

what can I put in the second argument that it automatically gives be the correct day without editing the code each year?





Newbie in search of knowledge
 
Have you tried my suggestion ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV thanks that worked we posted at the same time thus I missed your idea

Newbie in search of knowledge
 
The syntax
Code:
weekday(6/29/2006,vbTuesday)
Tells the system that Tuesday is the first day of the week so the numbering then becomes

1 = Tuesday
2 = Wednesday
:
5 = Saturday
6 = Sunday
7 = Monday

The default for the second argument is vbSunday with the numbering

0 = Sunday
1 = Monday
:
6 = Friday
7 = Saturday

Unless you have good reason for changing the day on which a week starts, just omit the second argument.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top