Click here to Skip to main content
15,923,087 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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..


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')
Posted
Updated 10-Dec-12 20:59pm
v2

1 solution

Hi,

Try like this.

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

SQL



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

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900