date.quarter() 函数
date.quarter()
返回指定时间的季度。结果范围为 [1-4]
。
函数类型签名
(t: A, ?location: {zone: string, offset: duration}) => int where A: Timeable
有关更多信息,请参阅 函数类型签名。
参数
t
(必需) 要操作的时间。
使用绝对时间、相对持续时间或整数。持续时间相对于 now()
。
location
用于确定时区的位置。默认为 location
选项。
示例
返回时间值的季度
import "date"
date.quarter(t: 2020-02-11T12:21:03.29353494Z)// Returns 1
返回相对持续时间的季度
import "date"
option now = () => 2020-02-11T12:21:03.29353494Z
date.quarter(t: -7mo)// Returns 2
返回当前季度
import "date"
date.quarter(t: now())
此页是否对您有帮助?
感谢您的反馈!