gpt4 book ai didi

r - 如何在 r 中使用 as.POSIXct 或 as.POSIXlt 获取毫秒数?

转载 作者:行者123 更新时间:2023-12-03 09:09:44 25 4
gpt4 key购买 nike

我想获得亚秒级,所以我使用以下内容:

> options(digits.secs=6)
> as.POSIXlt(df1$Global.Time[5]/1000, origin="1970-01-01", tz="America/Los_Angeles")
[1] "2005-06-15 07:53:42.7 PDT"

为什么输出不包含类似“07:53:42.700000”的内容?

POSIXct 同样的问题:

> as.POSIXct(df1$Global.Time[3]/1000, origin="1970-01-01",  tz="America/Los_Angeles")
[1] "2005-06-15 07:53:42.5 PDT"

最佳答案

这个怎么样(根据 Frank 的指示更正):

 d <- as.POSIXct(Sys.time())
format(d,"%Y-%m-%d %H:%M:%OS6")
[1] "2015-05-30 18:06:08.693852"

关于r - 如何在 r 中使用 as.POSIXct 或 as.POSIXlt 获取毫秒数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30551807/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com