sqlite 日期类型

前端之家收集整理的这篇文章主要介绍了sqlite 日期类型前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
SELECT * from msg


select * from msg where datetime(startDate)=datetime('2015-09-20')



select * from msg where datetime(endDate)>datetime('2015-09-22')

select * from msg where datetime(endDate)<datetime('2015-09-22')


SELECT  datetime(endDate,'localtime') as Time from msg 


SELECT  datetime('now','localtime') as Time from msg 
 
SELECT   strftime('%Y:%m:%d','now','localtime')  as Time from msg 
  
SELECT strftime('%m','now')as Time from msg 

select * from msg where strftime('%m',endDate)=strftime('%m','2015-08-01')

转载 http://blog.sina.com.cn/s/blog_60539d040101b5fk.html
</pre><p></p><p>创建数据库</p><p></p><pre name="code" class="java">CREATE TABLE msg ( _id INTEGER primary key autoincrement,id TEXT,startDate TEXT,endDate TEXT,title TEXT,comment TEXT,url TEXT,read TEXT);

插入测试数据
insert into msg (id,startDate,endDate,title,comment,url,read) values (101,'2015-09-20','2015-09-23','testtile','testcomment','testurl','testread');
insert into msg (id,read) values (102,'2015-09-24',read) values (103,'2015-09-25','testread');

insert into msg (id,'2015-05-20','2015-08-25','testread');


查询语句:

原文链接:https://www.f2er.com/sqlite/199314.html

猜你在找的Sqlite相关文章