...

View Full Version : comparing datetime



romram
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:

bcarl314
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.

romram
05-14-2004, 07:07 PM
I am using mysql...

Íkii
05-15-2004, 04:58 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum