Click here to get back home

How to query date between?

 HomeNewsGroups | Search | About
 mailing.database.mysql    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How to query date between? zdk 07-25-2006
Posted by zdk on July 25, 2006, 11:04 pm
Please log in for more thread options
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 ??


Posted by Jared on July 26, 2006, 12:35 am
Please log in for more thread options
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 ..."

>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 ??
>



Posted by zdk on July 26, 2006, 1:38 am
Please log in for more thread options
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 ..."
>
> >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 ??
> >


Similar ThreadsPosted
Converting VARCHAR "date" info to an actual date field August 15, 2005, 7:49 pm
How to fix the date in a MySQL db August 16, 2005, 12:40 pm
Date Format November 2, 2005, 7:17 pm
Date format February 1, 2006, 4:16 pm
Date format August 18, 2008, 4:11 pm
convert int date to datetime June 19, 2005, 4:33 pm
Date range sorting August 15, 2005, 9:31 am
Blank Date Field September 12, 2005, 1:41 pm
Mysql How to sum min max and get the date/time of the min max???? October 13, 2005, 4:23 am
selecting date records March 12, 2006, 7:49 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap