To give a little more detail, you can convert your character strings into POSIX objects, then extract from it virtually anything you would want using strftime. In particular, %W is how you get the week number:

> dateRange <- c("2008-10-01","2008-12-01")
> x <- as.POSIXlt(dateRange)
> strftime(x,format="%W")
[1] "39" "48"

--Patrick

On 02/22/2012 08:37 AM, Ingmar Visser wrote:
?strptime is a good place to start
hth, Ingmar

On Wed, Feb 22, 2012 at 2:09 PM, arunkumar1111<akpbond...@gmail.com>  wrote:

Hi

My data looks like this

startDate="2008-06-01"

dateRange =c( "2008-10-01","2008-12-01")
Is there any method to find the week number from the startDate range

______________________________________________
R-help@r-project.org 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 via email to