Hi Jeff,
Well, the output of "format" is character strings, so that is what you
are missing. I assume that you want to get two numeric values for each
date.
date1<-"06/20/2019 09:07"
> as.POSIXct(date1,format="%m/%d/%Y %H:%M")
[1] "2019-06-20 09:07:00 AEST"
day<-as.numeric(as.POSIXct(date1,format
R-Help
I'm using the following code to deparate the date and time components from a
date_time varaible as follows:
dt1$date <- format(as.POSIXct(dt1$date_time, format = "%m/%d/%Y %H:%M"),
"%Y-%m-%d")
dt1$time <- format(as.POSIXct(dt1$date_time, format = "%m/%d/%Y %H:%M"),
"%H:%M:%S")
B
2 matches
Mail list logo