as.POSIXct()
函数的格式字符串参数允许我将以下时间戳强制转换为POSIXct?
datetime <- "2018/02/08T23:58:33z"
datetime <- as.POSIXct(datetime, format = "%Y/%m/%d %H:%M:%S", tz = "UTC)
期望的结果
2018-02-08 23:58:33
答案 0 :(得分:4)
只需在字符串中放入一个文字“T”即可(默认情况下默认会忽略尾随字符):
Widget showMyName(String name) => Text(name);
答案 1 :(得分:1)
其他选项是使用自动解析的anytime
anytime::anytime(datetime, tz = "UTC", asUTC = TRUE)
#[1] "2018-02-08 23:58:33 UTC"