使用mongoTemplate查询某个时间段的文档,作为参数的开始和结束时间需要加上时区才行


在比较时,开始和结束时间被转成格林威治时间,被减掉8个小时,然后和库中文档时间比较,将查询结果和库中数据对比,发现取不到1998-08-08 08:08:08


所以加上8个小时,再转换成格林威治时间也能取到目标文档


使用mongoTemplate查询某个时间段的文档,作为参数的开始和结束时间需要加上时区才行
在比较时,开始和结束时间被转成格林威治时间,被减掉8个小时,然后和库中文档时间比较,将查询结果和库中数据对比,发现取不到1998-08-08 08:08:08
所以加上8个小时,再转换成格林威治时间也能取到目标文档
本文标题:Springboot中用Date类型查询MongoDB中ISOD
本文链接:https://www.haomeiwen.com/subject/sckhwftx.html
网友评论