Jump to content

query tomorrow


dadamssg

Recommended Posts

how do you query tomorrow? as in this will query todays date

 

SELECT * FROM test WHERE DATE(start) <= CURDATE() AND DATE(end) >= CURDATE()

 

i know theres somethin like CURDATE(interval + 1 day)...i know thats not it, but somethin similar is our there i know

Link to comment
Share on other sites

DAY -- singular; checking mysql_error() and the refman would have told you that.

 

N.B. you've now started 3 threads on basically the same topic... I would caution you against starting another one when there are existing threads to continue.

Link to comment
Share on other sites

k this isn't really the same as querying tom, but im trying not to open any new threads  :-[ anyways....im trying to query today...i thought i had it. I want to query everything going on today, whether its starting, ending, or today lands in between start and end. this is what i have which almost works...

 

SELECT * FROM test WHERE start <= NOW() AND end >= NOW() ORDER BY start ASC

 

it does not, however, pull up events that are happenning today but haven't started yet, examples below

 

i queried this at 12:50 pm and it pulled up

 

id              start                end

88  | 2/4/2009 1:00pm | 3/4/2009 1:00pm

85  | 3/1/2009 1:00pm | 3/3/2009 2:00pm

98  | 3/4/2009 1:00am | 3/6/2009 9:30pm

104 | 3/3/2009 1:00am | 3/3/2009 4:00pm

 

all these are correct BUT i also had the following in the database that it did NOT pull up

 

id              start                end

103  | 3/3/2009 1:00pm | 3/3/2009 7:00pm

105  | 3/3/2009 2:00pm | 3/3/2009 7:00pm

 

it didn't because 'start <= NOW()' but i don't really now what to replace this part with

 

oh and then when i queried at 1:10pm it pulled up event #103 of course

 

REAL LONG post but help would be MUCH appreciated thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.