date.time() 函数
date.time()
返回指定相对持续时间或时间的时间值。
date.time
假定持续时间值相对于 now()
。
函数类型签名
(t: A, ?location: {zone: string, offset: duration}) => time where A: Timeable
更多信息,请参阅 函数类型签名。
参数
t
(必需) 持续时间或时间值。
使用绝对时间或相对持续时间。持续时间相对于 now()
。
location
用于确定时区的位置。默认为 location
选项。
示例
返回给定时间的时间
import "date"
date.time(t: 2020-02-11T12:21:03.29353494Z)// Returns 2020-02-11T12:21:03.293534940Z
返回给定相对持续时间的时间
import "date"
option now = () => 2022-01-01T00:00:00Z
date.time(t: -1h)// Returns 2021-12-31T23:00:00.000000000Z
此页面是否对您有所帮助?
感谢您的反馈!