HI,
The question is not clear.? If it is to get the hours,
?strptime(dates, format="%d/%m/%Y %H:%M")$hour
# [1]? 0? 1? 2? 3? 4? 5? 6? 7? 8? 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23? 0
#or
?as.numeric(format(as.POSIXct(dates, format="%d/%m/%Y %H:%M"),"%H"))
# [1]? 0? 1? 2? 3? 4? 5? 6? 7? 8? 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23? 0
#or
as.numeric(gsub(".*\\s+(\\d+)\\:.*","\\1",dates))
?#[1]? 0? 1? 2? 3? 4? 5? 6? 7? 8? 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23? 0
A.K.
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"