[R] why is as.date function not working for me? (dd/mm/yyyy h:mm)

jcrosbie james at crosb.ie
Thu Feb 6 19:24:48 CET 2014


Why am I know getting hours after I convert the date?

 dates <- c('31/12/2013 0:00',  '31/12/2013 1:00',  '31/12/2013 2:00', 
'31/12/2013 3:00',  '31/12/2013 4:00',  '31/12/2013 5:00',  '31/12/2013
6:00',  '31/12/2013 7:00',  '31/12/2013 8:00',  '31/12/2013 9:00',
'31/12/2013 10:00', '31/12/2013 11:00',  '31/12/2013 12:00', '31/12/2013
13:00', '31/12/2013 14:00', '31/12/2013 15:00',  '31/12/2013 16:00',
'31/12/2013 17:00', '31/12/2013 18:00', '31/12/2013 19:00', '31/12/2013
20:00', '31/12/2013 21:00', '31/12/2013 22:00', '31/12/2013 23:00', 
'01/01/2014 0:00')

as.Date(dates, format="%d/%m/%Y %H:%M")
 [1] "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31"
 [6] "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31"
[11] "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31"
[16] "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31"
[21] "2013-12-31" "2013-12-31" "2013-12-31" "2013-12-31" "2014-01-01"





--
View this message in context: http://r.789695.n4.nabble.com/why-is-as-date-function-not-working-for-me-dd-mm-yyyy-h-mm-tp4684874.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list