View Full Version : comparing datetime
romram
05-12-2004, 11:35 AM
We have in our database two fields with datetime type..
How to compare that a date is between these two dates???? :confused:
bcarl314
05-12-2004, 12:57 PM
What database server are you using? MySQL, SQL Server, Oracle? They all have similar but different date functions and handle dates a little different.
romram
05-14-2004, 06:07 PM
I am using mysql...
Presuming your input date format is a string of the order '2004-05-15 12:00:00' then you can just use the < less than and > greater than operators.
... 'WHERE `strt_date` < '.$input_date.' AND `end_date` > '.$input_date
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.