I am new for R, now I want to write a time like "2023-09-15 00:00:00", so I write the code
time1<- as.POSIXct("2013-9-15 00:00:00",format="%Y-%m-%d %H:%M:%OS")
print(time1) # [1] "2013-09-15 CST"
but it’s not run. I’d appreciate it if you could help me.
>Solution :
time1 <- as.POSIXct("2013-9-15 00:00:00")
time2 <- format(time1, "%Y-%m-%d %H:%M:%OS")
print(time2)