i have a problem with php
$filename = "../ajax_php/5.jpg";
$tanggal = date("d-m-Y", filemtime($filename));
echo $tanggal . "<br/>"; // 26-06-2013
$add_days = 3;
$baru = date('d-m-Y',strtotime($tanggal) + (24*3600*$add_days));
echo $baru . "<br/>"; // 29-06-2013
$skrg = date('d-m-Y');
echo $skrg . "<br/>"; // 07-12-2013
if($baru < $skrg){
echo "<br/> yes";
}
when i compare 2 date using if $baru < $skrg that should be get output yes, but i fail to get the output
can someone help me?? how to compare 2 date using php??
filemtimereturns a unix timestamp. you should probably use that format. Alternatively, look into usingDateTimePHP class to create date/time objects - these can be compared transparently, and it contains are more reliable inbuilt ways to add/subtract time from a date.