0

I'm having problems with this SELECT sentence WHERE:

WHERE event.date >= CURDATE() AND event.hour >= CURTIME()

I want to get the next events in my MySQL table, but I can't do that when my computer (as the server, or using an outside server) is between 12h00 And 00h00. Something like 6pm, it doesn't work, but when it's on 1am it's working.

Any ideas?

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • What is the format of `event.hour`? Is it a `varchar` field? – MonkeyZeus Jan 30 '14 at 02:24
  • Any reason you have these fields separate? – Kermit Jan 30 '14 at 15:29
  • i thought it would be easier to handle them separate, because in some queries I need just the hour and others just the date. Some of them ordered by date, some by hour... this kind of stuff. Am I wrong about that? Its not easier? – user3187888 Jan 30 '14 at 18:19

2 Answers2

0

May be related (depending on the data format of your event.hour column) related to the timezone of your server.

Check this for how to set mysql timezone: How do I set the time zone of MySQL?

Community
  • 1
  • 1
Graben
  • 202
  • 3
  • 8
0

The problem was in the sentence, the right sentence is this:

WHERE (event.date > CURDATE() OR (event.date = CURDATE() AND event.hour >= CURTIME()))

Thank you guys for your time try