简体   繁体   中英

Convert string with single digit month and date string to class Date

I have a date in the string format of 232014 4:20 standing for 02/03/2014 04:20. I am wondering how I can transform this string to a real date format (class Date )?

Thank you!

You will not be able to. Your format is ambiguous. For example, if you have 1122014 is that 1/12/2014 or 11/2/2014?

if your csv is saved as "02/03/2014 04:20"

x<-read.csv(..., as.is=T)
x[,1]<-strptime(as.character(x[,1]), "%d/%m/%Y %H:%M")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM