开发者

Twitter created_at timestamp comparing it in php

开发者 https://www.devze.com 2023-04-05 18:44 出处:网络
In the twitter API each 开发者_如何学Pythontweet has a timestamp a property of \"created_at\" The format is \"Sat Sep 17 14:48:57 +0000 2011\";

In the twitter API each 开发者_如何学Pythontweet has a timestamp a property of "created_at"

The format is "Sat Sep 17 14:48:57 +0000 2011";

The user should get a point every 24 hours for a tweet..

how will I do date compare with this timestamp in php?

$tweetTimestamp = strtotime('Sat Sep 17 14:48:57 +0000 2011');

if($tweetTimestamp > 84600) {
echo ' update tweet points';
}
else {
    echo ' no points';
}


time() - $tweetTimestamp will give you the number of seconds that have passed since $tweetTimestamp.


$tweetTimestamp = strtotime('Sat Sep 17 14:48:57 +0000 2011');

if(time() - $tweetTimestamp > 84600) {
echo ' update tweet points';
}
else {
    echo ' no points';
}
0

精彩评论

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