如何转换时间戳字符串“2014-07-20T05:11:49.988Z"到 R 中的 POSIXt? [英] How to convert time stamp string "2014-07-20T05:11:49.988Z" into POSIXt in R?

查看:29
本文介绍了如何转换时间戳字符串“2014-07-20T05:11:49.988Z"到 R 中的 POSIXt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将时间戳字符串2014-07-20T05:11:49.988Z"转换为 R 中的 POSIXt?

How to convert time stamp string "2014-07-20T05:11:49.988Z" into POSIXt in R?

我想知道为什么第二个以 3 个小数位表示?在时间戳末尾附加Z"是什么意思?谁能知道这个字符串如何在 R 中转换为时间

I want to know why the second is represented in 3 decimel places? also what is the meaning of appending the 'Z' at the end of time stamp? Can anybody know how this string can be converted into time in R

推荐答案

Z"是 UTC 简写.您可以使用

x <- as.POSIXct("2014-07-20T05:11:49.998Z", 
    format="%Y-%m-%dT%H:%M:%OSZ", tz="GMT")

请注意,您通常使用 POSIXct 或 POSIXlt 而不是直接使用 POSIXt(两者都将 POSIXt 作为基类)

Note that you generally either use POSIXct or POSIXlt rather than POSIXt directly (both have POSIXt as a base class)

这篇关于如何转换时间戳字符串“2014-07-20T05:11:49.988Z"到 R 中的 POSIXt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆