Colon in date format between seconds and milliseconds. How to parse in R?
问题 How can I parse this date format? Should I change this colon to dot or maybe someone know better solution? > x <- "2012.01.15 09:00:02:002" > strptime(x, "%Y.%m.%d %H:%M:%S:%OS") [1] "2012-01-15 09:00:02" > strptime(x, "%Y.%m.%d %H:%M:%OS") [1] "2012-01-15 09:00:02" > x <- "2012.01.15 09:00:02.002" > strptime(x, "%Y.%m.%d %H:%M:%OS") [1] "2012-01-15 09:00:02.001" 回答1: There's a subtle distinction here that may be throwing you off. As ?strptime notes: for 'strptime' '%OS' will input seconds