如何在 SQLite 中存储和获取日期时间值 [英] How to store and get datetime value in SQLite
本文介绍了如何在 SQLite 中存储和获取日期时间值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表包含数据类型为日期时间的出生日期字段.我想获得今天生日的所有记录.我怎样才能得到它?
My table contains Birthdate field which has datatype as datetime. I want to get all records having birthday today. How can I get it?
推荐答案
试试这个查询:
SELECT * FROM mytable
WHERE strftime('%m-%d', 'now') = strftime('%m-%d', birthday)
这篇关于如何在 SQLite 中存储和获取日期时间值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文