[R] convert 12 time stamp to 24 hour

e-letter inpost at gmail.com
Fri Feb 8 10:44:55 CET 2013


Readers,

For a 12 hour time stamp:

> testtime<-("2013-01-01 01:00:01 PM")
> testtime
[1] "2013-01-01 01:00:01 PM"
> testtime24hour<-strftime(testtime,'%H:%M:%S')
> testtime24hour
[1] "01:00:01"

how to convert to 24 hour format so that the object 'testtime24hour' is:

'13:00:01'

Thanks.

--
r2151



More information about the R-help mailing list