sqlite中的datetime函数问题 [英] datetime function issue in sqlite

查看:65
本文介绍了sqlite中的datetime函数问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子和

两个明星时间和结束时间的字段



I am have one table and
two fields of star time and end time

both field has type datetime





现在我使用的查询类似





now i am using query like

select * from table where datetime(''now'') between startTime and endTime..





问题我在两个日期之间有5个数据

我只得到一个..



我做了一些RND,我发现两个格式化功能有一些问题



ie

table'提交的是日期时间

和datetime的功能(''now'')



issue is I have 5 data between two date
and I am getting only one..

I did some RND and I find that there is some issue betwwen two formatting function

i.e.
table''s filed is datetime
and function of datetime(''now'')

推荐答案





试试这样。



Hi,

Try like this.

SELECT * FROM table WHERE
    strftime('%s', date) BETWEEN strftime('%s', start_date) AND strftime('%s, end_date)









对于参考资料查看以下链接。

1. 日期和时间函数1

2. 日期和时间功能2



谢谢



For references view the following links.
1. Date And Time Functions1
2. Date and time funcions2

Thanks


这篇关于sqlite中的datetime函数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆