当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


R lubridate now 当前日期和时间

当前日期和时间

用法

now(tzone = "")

today(tzone = "")

参数

tzone

一个字符向量,指定您希望当前时间所在的时区。tzone 默认为您计算机的系统时区。您可以使用 now("UTC") 检索通用协调时间 (UTC) 中的当前时间。

now - 作为 POSIXct 对象的当前日期时间

例子

now()
#> [1] "2023-02-14 11:55:06 UTC"
now("GMT")
#> [1] "2023-02-14 11:55:06 GMT"
now("")
#> [1] "2023-02-14 11:55:06 UTC"
now() == now() # would be TRUE if computer processed both at the same instant
#> [1] FALSE
now() < now() # TRUE
#> [1] TRUE
now() > now() # FALSE
#> [1] FALSE
today()
#> [1] "2023-02-14"
today("GMT")
#> [1] "2023-02-14"
today() == today("GMT") # not always true
#> [1] TRUE
today() < as.Date("2999-01-01") # TRUE  (so far)
#> [1] TRUE
源代码:R/instants.r

相关用法


注:本文由纯净天空筛选整理自Hadley Wickham等大神的英文原创作品 The current day and time。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。