Day of Week from dd/mm/yyyy

S

sort

How do you find the Day of Week from a given date, "dd/mm/yyyy". I know it
is given by "dddd" but I need the reverse process. I would be open to the
numbers of the Day of Week too.

I am given the:
mm=11
dd=15
yyyy=2009

find
dddd or number of the Day of Week
 
L

Lars-Åke Aspelin

How do you find the Day of Week from a given date, "dd/mm/yyyy". I know it
is given by "dddd" but I need the reverse process. I would be open to the
numbers of the Day of Week too.

I am given the:
mm=11
dd=15
yyyy=2009

find
dddd or number of the Day of Week

The formula
=WEEKDAY(DATE(2009,11,15),2)
returns the value 7, indicating that November 15, 2009 was a Sunday.

Hope this helps / Lars-Åke
 
H

Helmut Meukel

Lars-Åke Aspelin said:
The formula
=WEEKDAY(DATE(2009,11,15),2)
returns the value 7, indicating that November 15, 2009 was a Sunday.

Hope this helps / Lars-Åke


Or in VBA:
Dim mm as Integer, dd as Integer, yyyy as Integer, dddd as string
mm=11
dd=15
yyyy=2009
dddd = Format(DateSerial(yyyy, mm, dd), "dddd")

Helmut.
 
O

OssieMac

Additional options to the previous answer.

The following returns the day of the week for any date. (I have used today's
date in each of the examples)

On a worksheet:
=TEXT(TODAY(),"ddd")
or
=TEXT(TODAY(),"dddd")

In VBA
Dim DayOfWeek As String

DayOfWeek = Format(Date, "ddd")
MsgBox DayOfWeek

DayOfWeek = Format(Date, "dddd")
MsgBox DayOfWeek
 
S

sort

=WEEKDAY(DATE(2009,11,15),2) would be perfect but I am looking for something
to put in a VBA program not in a cell.
 
F

FSt1

hi
if your given date is in A1, try this to put the weekday name in b1......
Sub xlcalcit()
Dim s As String
Dim d As String
s = [A1].Value
d = WeekdayName(Weekday(s))
[B1].Value = d
End Sub
 
F

FSt1

afterthought
the code i posted will work on any date, past, current or future.

regards
FSt1

FSt1 said:
hi
if your given date is in A1, try this to put the weekday name in b1......
Sub xlcalcit()
Dim s As String
Dim d As String
s = [A1].Value
d = WeekdayName(Weekday(s))
[B1].Value = d
End Sub

sort said:
How do you find the Day of Week from a given date, "dd/mm/yyyy". I know it
is given by "dddd" but I need the reverse process. I would be open to the
numbers of the Day of Week too.

I am given the:
mm=11
dd=15
yyyy=2009

find
dddd or number of the Day of Week
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top