gpt4 book ai didi

database - 如何在Sqlite中找到两个日期之间的中间点

转载 作者:行者123 更新时间:2023-12-02 16:58:49 24 4
gpt4 key购买 nike

我有这些日期:

"2019-01-01" and "2019-01-05",我需要这个"2019-01-03"

如何在 Sqlite 上执行此操作?我试过DateAdd(ms, DateDiff(ms, date1, date2), date1)/2但这在 SQLite 中不起作用,此查询给出以下错误:Result: no such column: ms

最佳答案

sqlite 不是 mysql 或不是 postgresql

This link将显示所有操作日期的函数。

对于您的问题,解决方案可以是:

 select datetime(strftime('%s','2019-01-01') + 
(strftime('%s','2019-01-05')-strftime('%s','2019-01-01'))/2,
'unixepoch');

关于database - 如何在Sqlite中找到两个日期之间的中间点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58721481/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com