homepage Welcome to WebmasterWorld Guest from 50.19.155.235
register, login, search, subscribe, help, library, PubCon, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library : Charter : Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
mysql query with date search
hozyali




msg:4249969
 7:47 pm on Jan 6, 2011 (gmt 0)

I have a table which has dates for events.
the mysql column type is datetime

Now I have a calendar which returns date only (not time)
and I have full date and time both in mysql records.

So I want to run the query so it searches for all the events in that specific date?

please advise.

thanks in advance.

 

chorny




msg:4249979
 8:13 pm on Jan 6, 2011 (gmt 0)

Readable way:

DATE(event_date)=?

Optimized way (if you have millions of records):

where event_date > "$date 00:00:00" and event_date <= "$date 23:59:59"
hozyali




msg:4249986
 8:25 pm on Jan 6, 2011 (gmt 0)

Hi,

thanks very much for helping. Yes, I already tried with DATE() and it worked perfectly fine.

Thanks again for your help.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of Pubcon Inc.
© Pubcon Inc. 1996-2012 all rights reserved