datetime - Extracting 2 digit hour from POSIXct in R -
i extract hour posixct
time in r, retrieve 2 digit answer.
for example,
test=as.posixct("2015-03-02 03:15:00") test [1] "2015-01-02 03:15:00 gmt" month(testing) [1] 1 hour(testing) [1] 3
the results give relevant month , hour, see 01
, 03
instead of 1
, 3
.
try this:
strftime(test, format="%h")
to extract hours and
strftime(test, format="%m")
for month
Comments
Post a Comment