boundaries.thursday() 函数
boundaries.thursday() 返回一个记录,包含上个星期四的 start 和 stop 边界时间戳。
上个星期四相对于 now()。如果今天是星期四,函数返回上个星期四的边界。
函数类型签名
() => {stop: time, start: time}
有关更多信息,请参见 Function type signatures。
示例
返回上星期四的开始和结束时间戳
import "date/boundaries"
option location = timezone.fixed(offset: -8h)
option now = () => 2021-12-30T00:40:44Z
boundaries.thursday()// Returns {start: 2021-12-23T08:00:00Z, stop:2021-12-24T08:00:00Z }
查询上周四收集的数据
import "date/boundaries"
day = boundaries.thursday()
from(bucket: "example-bucket")
|> range(start: day.start, stop: day.stop)