bar的开发手册的问题

开发手册中,https://dolphindb.cn/cn/help/FunctionsandCommands/FunctionReferences/b/bar.html?highlight=bar

t=table(2022.01.01 + 1..20  as time, rand(100, 20) as x)
select max(x) from t group by bar(time, 7d);

为什么查询结果是,2021.12.30开头的?

请先 登录 后评论

1 个回答

Feng Gao

dolphindb时间存储在数据库中,是存储成int或者long类型的
从1970.01.01,开始存储的
然后,2022.01.02,之所以分组成,2021.12.30,是根据计算获得的,计算公式如下:
2022.01.02 - int(2022.01.02) % 7

关于计算的描述如下:

attachments-2022-03-uaqz8dzH6245c0c6c7077.png

请先 登录 后评论
  • 1 关注
  • 0 收藏,866 浏览
  • dongmange 提出于 2022-03-31 22:52

相似问题