matrix_ — 2011-12-16T16:42:34-05:00 — #1
How would I go about checking mysql date/time formated field for all records with tomorrows date.. ?
r937 — 2011-12-16T17:12:05-05:00 — #2
you do mean DATETIME, not DATE, right?
WHERE column >= CURRENT_DATE + INTERVAL 1 DAY
AND column < CURRENT_DATE + INTERVAL 2 DAY
fyi, we call them columns and rows, not fields and records
matrix_ — 2011-12-16T17:17:33-05:00 — #3
Yea definatly DATE/TIME.. It apears to work.. But I have a small issue as this will be run as a cron job, but ther server is on a different time zone.. So the records wont match to the date of the server.
r937 — 2011-12-16T17:29:31-05:00 — #4
so add or subtract the requisite number of hours...
matrix_ — 2011-12-16T17:40:55-05:00 — #5
Via the query or in the cron job?
r937 — 2011-12-16T19:39:18-05:00 — #6
you can do it in the query...
WHERE column >= CURRENT_DATE + INTERVAL 1 DAY - INTERVAL 3 HOUR
AND column < CURRENT_DATE + INTERVAL 2 DAY - INTERVAL 3 HOUR
matrix_ — 2011-12-17T05:58:00-05:00 — #7
Does the query only take the DATE part of the field into consideration? so it doesnt matter at what hour the query runs it will grab all records for the follwoing day no matter what the TIME part of the field is?
r937 — 2011-12-17T06:00:23-05:00 — #8
what happened when you tested it?
matrix_ — 2011-12-20T01:56:44-05:00 — #9
I thought it missed records from a certain hours.. But looks like it takes the date only into consideration..