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

Returning the day of the week from a given date

Status
Not open for further replies.

kgomotso

Programmer
Oct 31, 2000
20
ZA
I Need to be able to return the day of the week (e.g.Monday,Tuesday etc) from a give date(e.g. 12/09/2001).
Is there a function or anyway at all that I can do this
 
intDay = DatePart("w",now(),vbSunday)
select case intDay
case 1
strDay = "Sunday"
case 2
strDay = "Monday"
case 3
strDay = "Tuesday"
case 4
strDay = "Wednesday"
case 5
strDay = "Thursday"
case 6
strDay = "Friday"
case 7
strDay = "Saturday"
end select
msgbox strday
It`s a bit long but it works. For the name of the month you can use:
monthname(Month(now()))
 
[bold]WeekdayName(WeekDay, Abbreviate, FirstDayofWeek) [/bold]

The WeekdayName function returns the full spelling of the name of the day of the week.

There is one mandatory argument.

[bold]WeekDay [/bold]

Code:
<%= WeekdayName(7) %>

Output:
Saturday

with sunday=1,monday=2, etc.
------------------------------------
to pull weekday name from full date:

<%= WeekdayName(DatePart(&quot;w&quot;,now(),vbSunday)) %>

Output:
Tuesday


full description at:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top