PC Review


Reply
Thread Tools Rate Thread

Day of Week from dd/mm/yyyy

 
 
sort
Guest
Posts: n/a
 
      30th May 2010
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
 
Reply With Quote
 
 
 
 
Lars-Åke Aspelin
Guest
Posts: n/a
 
      30th May 2010
On Sun, 30 May 2010 14:26:01 -0700, sort
<(E-Mail Removed)> wrote:

>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

 
Reply With Quote
 
Helmut Meukel
Guest
Posts: n/a
 
      30th May 2010
"Lars-Åke Aspelin" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> On Sun, 30 May 2010 14:26:01 -0700, sort
> <(E-Mail Removed)> wrote:
>
>>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
>



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.


 
Reply With Quote
 
OssieMac
Guest
Posts: n/a
 
      30th May 2010
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

--
Regards,

OssieMac


"sort" wrote:

> 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

 
Reply With Quote
 
sort
Guest
Posts: n/a
 
      30th May 2010
=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.
 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      31st May 2010
Did you read Ossie's post?



"sort" <(E-Mail Removed)> wrote in message
news:13DB4AF8-B7A2-4BC0-9CEC-(E-Mail Removed)...
> =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.



 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      31st May 2010
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" wrote:

> 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

 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      31st May 2010
afterthought
the code i posted will work on any date, past, current or future.

regards
FSt1

"FSt1" wrote:

> 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" wrote:
>
> > 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding 1 year's difference to user's input of yyyy-yyyy? StargateFanFromWork Microsoft Excel Discussion 3 29th May 2007 05:25 PM
how do I change date from mm/dd/yyyy to dd:mm:yyyy format in Excel =?Utf-8?B?SmFjayBXaWxzb24=?= Microsoft Excel New Users 4 18th Jul 2006 01:57 PM
How do I query a Date field (mm/dd/yyyy) by a Year (yyyy) value. Wayne Microsoft Access Queries 2 23rd Feb 2006 12:24 AM
opening excel file -> date format problem: DD/MM/YYYY vs MM/DD/YYYY yung Microsoft Excel Programming 2 18th Mar 2005 12:50 PM
Date format : field set to dd/mm/yyyy, but query wants mm/dd/yyyy aa Microsoft Access 2 29th Dec 2003 10:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:03 AM.