Skip to content
Back to formatted view

Raw Message

Message-ID: <439E9BA2.5070206@metrak.com>
Date: 2005-12-13T10:00:02Z
From: paul sorenson
Subject: date handling
In-Reply-To: <a3e689eb0512120359w7961af63nf6e47a48d8e13d74@mail.gmail.com>

d = as.POSIXlt(c("2005-07-01", "2005-07-02", "2005-07-03", "2005-07-04", 
"2005-07-05"))
d$mon and d$year will get you part way there.

That is assuming your dates are formated yyyy-mm-dd.  strptime() might 
also be useful.

Richard van Wingerden wrote:
> Hi,
> 
> Given a frame with calendar date's:
> 
> "2005-07-01", "2005-07-02","2005-07-03","2005-07-04","2005-07-05",etc.
> 
> I want to extract the following from these dates:
> 
> week number
> month number
> year number
> 
> Any ideas how to accomplish this?
> 
> Many thanks.
> 
> Regards,
> Richard
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>