我对时间数据的观察是“2007年10月31日星期三13:42:46”。 我想转换为“2007-10-31 13:42:46”格式(删除星期三)。 我怎么能转换它?
答案 0 :(得分:1)
正如@thelatemail所说
x <- "Wed Oct 31 13:42:46 2007"
x <- as.POSIXct(x, format = "%a %b %d %T %Y", tz = "GMT")
# %a day of week, %b month of year, %d day of month as decimal, %T H:M:S, %Y year with century
x
[1] "2007-10-31 13:42:46 GMT"