$now=date('Y-m-d H:i:s',time()); //2009-10-27 15:04:09
//add time
strtotime($now.'+1 second'); //2009-10-27 15:04:10 (try with: +3 months or -1 year ...
//change format
$now=gmdate("dS M,Y H:i", strtotime($now)); //27th Oct,2009 12:40
//compare dates
$today = strtotime($todayDate);
$from = strtotime($_product->getData("news_from_date"));
if($from < $today)
echo "NEW!";
//convert spanish date to MySQL format on PHP 5.3
$spanishDate = '13/11/2011 18:20';
$date = DateTime::createFromFormat('d/m/Y H:i', $spanishDate);
$mysqlField = $date->format('Y-m-d H:i:s');
//convert spanish date to MySQL format on PHP 5.2
$spanishDate = "25/11/2011 09:35:10";
$date = substr($datetime, 0, strpos($spanishDate," "));
$time = substr($datetime, strpos($spanishDate," ") + 1);
list($d,$m,$Y)=explode("/",$date);
list($H,$i,$s)=explode(":",$time);
$mysqlField = "$Y-$m-$d $H:$i:$s";
Tags: compare, date, dates, PHP, strtotime