View Full Version : comparing datetime
05-12-2004, 12:35 PM
We have in our database two fields with datetime type..
How to compare that a date is between these two dates???? :confused:
05-12-2004, 01: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.
05-14-2004, 07: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
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.