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

Getting day from a date 2

Status
Not open for further replies.

Pete222

Programmer
Dec 29, 2002
85
0
0
GB
I'm making a diary...but it only says the date (e.g. 4/8/02) and I want to convert that into the day name (e.g. sunday). thx for any help!

Pete.
My site: clix.to/F
 
Try using this function:

Public Function GetDay(dteDate As Date) As String

Dim intDay As Integer

intDay = Weekday(dteDate)

Select Case intDay
Case 1
GetDay = "Sunday"
Case 2
GetDay = "Monday"
Case 3
GetDay = "Tuesday"
Case 4
GetDay = "Wednesday"
Case 5
GetDay = "Thursday"
Case 6
GetDay = "Friday"
Case 7
GetDay = "Saturday"
End Select

End Function
 
Or just:

= Format("4/8/02","dddd")
 
Thx, both work!

Pete.
My site: clix.to/F
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top