From date to week day

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

From date to week day

Anna Lippel
This post has NOT been accepted by the mailing list yet.
Hello guys, is there a function that allows me to get the week day ( monday, tuesday, etc...) from a given date ( 01/05/2007 for ex)? Thanks a lot!
Reply | Threaded
Open this post in threaded view
|

Re: From date to week day

Wu Gong
?strptime will helps.


> d <- as.Date("01/05/2007","%m/%d/%Y")
> format(d, "%A, %b %d, %Y")
[1] "Friday, Jan 05, 2007"
Reply | Threaded
Open this post in threaded view
|

Re: From date to week day

Stephan Kolassa
Or:
weekdays(as.Date("2010-05-24"))

HTH,
Stephan


Wu Gong schrieb:
> ?strptime will helps.
>
>
>> d <- as.Date("01/05/2007","%m/%d/%Y")
>> format(d, "%A, %b %d, %Y")
> [1] "Friday, Jan 05, 2007"
>
> -----
> A R learner.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: From date to week day

Anna Lippel
This post has NOT been accepted by the mailing list yet.
In reply to this post by Wu Gong
Hi Wu! Thanks a lot it worked perfectly!
Reply | Threaded
Open this post in threaded view
|

Re: From date to week day

Anna Lippel
This post has NOT been accepted by the mailing list yet.
In reply to this post by Stephan Kolassa
In my code your code only work if I mention the format:
weekdays(as.Date("2010/05/24","%m/%d/%Y")) but actually it's more explicit as it contains weekdays and makes it more easy for me to remember what I am doing rereading my code :) thanks!