PHP How to compare date and date?

Studly

New Member
I have this value from database:'2009-1-1 00:00:00', okay, let me paste my code:\[code\]$fetch = mysql_fetch_assoc($result);$db_value = http://stackoverflow.com/questions/2355075/$fetch['date'];//'2009-1-1 00:00:00'$today = date('Y-m-d H:i:s'); // Todays date\[/code\]If I want to compare the two values, what should I do:\[code\]if($db_value < $today){ // Do something}\[/code\]or method 2, convert to strtotime:\[code\]if(strtotime($db_value) < strtotime($today)){ // Do someting}\[/code\]Maybe my method is not correct, what should I use to compare 2 dates?
 
Top