开发者

determining if timestamp is earlier or later?

开发者 https://www.devze.com 2023-03-19 10:40 出处:网络
So I have a timestamp saved in MySQL as 2011-07-10 14:36:25and 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 timestam

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消