[R] Datetime conversion

David Winsemius dwinsemius at comcast.net
Fri Sep 18 08:15:58 CEST 2009


On Sep 18, 2009, at 1:03 AM, premmad wrote:

>
> I'm relatively new to R .I tried converting the datetime column with  
> values
> like 01apr1985:00:00:00.000 using strptime(datetime,"%d%b%Y).Could  
> anyone
> help me in this regard .Please reply ASAP i need .

You will need to give us a more complete sample of your code, because  
I don't see a problem:

 > strptime("01apr1985:00:00:00.000","%d%b%Y")
[1] "1985-04-01"

also works when hours, minutes and seconds format was used:

> > strptime("01apr1985:00:00:00.000","%d%b%Y:%H:%M:%S")
> [1] "1985-04-01"
> > strptime("01apr1985:00:00:00.000","%d%b%Y:%T")
> [1] "1985-04-01"
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list