determining if timestamp is earlier or later?
So I have a timestamp saved in MySQL as 2011-07-10 14:36:25 and in Android as 2011-07-10 15:19:57.
In PHP I have both timestamps passed through strtotime(). My goal: I want to find out if the timestamp in MySQL is earlier or later then the timestamp from Android. I want to update MySQL if the Android timestamp is later then the timestamp saved in MySQL. If the Android timestamp is earlier then the timestamp from MySQL, then I don't want it to update.
$siteDate: 2011-07-10 14:36:25
$appDate: 2011-07-10 15:19:57
This is what I have:
$siteDate = strtotime($r[edited]);
$appDate = strtotime($jsonArtist[$i][edited]);
if($siteDate>$appDate){
echo"no update\n开发者_如何转开发";
}else{
echo "update\n";
}
So am I doing this wrong?
精彩评论