Try

my.date <- strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS")

Then you can examine my.date$mon.
--
Robert Tirrell | r...@stanford.edu | (607) 437-6532
Program in Biomedical Informatics | Butte Lab | Stanford University



On Thu, Feb 24, 2011 at 14:12, Belle <ping...@gmail.com> wrote:

>
> I think I got it, I post it here see if you have better way, please let me
> know.
>
> index <- rep(0, length(mydata[,1]))
> index[as.Date(mydata3$Date) < as.Date("2006-11-30 23:29:29 PM") &
> as.Date(mydata3$Date) > as.Date("2006-09-01 00:00:00 AM")] <- 1
> index[as.Date(mydata3$Date) < as.Date("2007-11-30 23:29:29 PM") &
> as.Date(mydata3$Date) > as.Date("2007-09-01 00:00:00 AM")] <- 1
> index[as.Date(mydata3$Date) < as.Date("2008-11-30 23:29:29 PM") &
> as.Date(mydata3$Date) > as.Date("2008-09-01 00:00:00 AM")] <- 1
> index[as.Date(mydata3$Date) < as.Date("2009-11-30 23:29:29 PM") &
> as.Date(mydata3$Date) > as.Date("2009-09-01 00:00:00 AM")] <- 1
> index[as.Date(mydata3$Date) < as.Date("2010-11-30 23:29:29 PM") &
> as.Date(mydata3$Date) > as.Date("2010-09-01 00:00:00 AM")] <- 1
>
> Thanks
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Selecting-data-based-on-the-range-of-dates-tp3323452p3323536.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
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