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

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -