您好,欢迎来到五一七教育网。
搜索
您的当前位置:首页java yyyy-mm-ddthh:mm:ssz,解析格式为YYYY-MM-DDTHH-MM-SSZ的ISO 8601日期时间

java yyyy-mm-ddthh:mm:ssz,解析格式为YYYY-MM-DDTHH-MM-SSZ的ISO 8601日期时间

来源:五一七教育网

I have a large dataframe with time stamps that look like this:

"2019-05-15T01:42:15.072Z"

How can I parse this string into a real date-time format?

The characters (T and Z) inside the data seems to make it difficult.

解决方案

You can simply parse the timestamp by specifying the format in as.POSIXct (or strptime)

as.POSIXct("2019-05-15T01:42:15.072Z", format = "%Y-%m-%dT%H:%M:%OSZ")

#[1] "2019-05-15 01:42:15 AEST"

Explanation:

%Y, %m and %d denote the year (with century), month and day; %H, %M and %OS denote the hours, minutes and seconds (including milliseconds). The T and Z are simply added to the format string, because

Any character in the format string not part of a conversion specification is interpreted literally

See ?strptime for the different conversion specifications.

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 517ttc.cn 版权所有 赣ICP备2024042791号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务