469,628 Members | 1,077 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

How to query date between?

zdk
I have table name "actionlog",and one field in there is "date_time"
date_time (Type:datetime) example value : 11/1/2006 11:05:07

if I'd like to query date between 24/07/2006 to 26/07/2006(I don't
need time),how to write SQL command?

select * from actionlog where date_time 24/07/2006 AND date_time <
24/07/2006 ??

Jul 26 '06 #1
2 38778
query is correct but you will need to format your date like so yyyy-MM-dd

YourSQL = "select * from table where date_col < " +
yourdate.tostring("yyyy-MM-dd") " AND ..."

"zdk" <nx****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I have table name "actionlog",and one field in there is "date_time"
date_time (Type:datetime) example value : 11/1/2006 11:05:07

if I'd like to query date between 24/07/2006 to 26/07/2006(I don't
need time),how to write SQL command?

select * from actionlog where date_time 24/07/2006 AND date_time <
24/07/2006 ??

Jul 26 '06 #2
zdk
Thanks a lot.

Jared wrote:
query is correct but you will need to format your date like so yyyy-MM-dd

YourSQL = "select * from table where date_col < " +
yourdate.tostring("yyyy-MM-dd") " AND ..."

"zdk" <nx****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I have table name "actionlog",and one field in there is "date_time"
date_time (Type:datetime) example value : 11/1/2006 11:05:07

if I'd like to query date between 24/07/2006 to 26/07/2006(I don't
need time),how to write SQL command?

select * from actionlog where date_time 24/07/2006 AND date_time <
24/07/2006 ??
Jul 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Adam Louis | last post: by
10 posts views Thread by Kenneth | last post: by
11 posts views Thread by Andy_Khosravi | last post: by
10 posts views Thread by Daniel | last post: by
12 posts views Thread by Michel Esber | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.