木子屋 Dnawo's BLOG

SQLite常用日期时间函数

👤 dnawo 📅 2020-05-28 👁 3442 👍 0 💬 0 🔄 本站原创
当天日期:
select date('now') --2020-05-28

当前时间:
select time('now') --04:03:22

当前时间-北京时间:
select datetime('now', 'localtime') --2020-05-28 12:03:22

6年以后:
select date('now', '+6 years') --2026-05-28

6月以后:
select date('now', '+6 months') --2020-11-28

6天以后:
select date('now', '+6 days') --2020-06-03

当年1月1日:
select date('now', 'start of year') --2020-01-01

当年5月1日:
select date('now', 'start of year', '+4 months') --2020-05-01

当月的第一天:
select date('now', 'start of month') --2020-05-01

当月最后一天:
select date('now', 'start of month', '+1 months', '-1 days') --2020-05-31


参考资料

[1].SQLite 日期 & 时间:https://www.runoob.com/sqlite/sqlite-date-time.html

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 IIS整站静态文件html/js/css出现500错误无法打开解… 下一篇 → 推荐用百度网盘APP下载MSDN原版系统ISO镜像文件