PHP MYSQL与数据库中创建的时间进行比较

I want to check if 30 min passed after created time in database. created is a time column having time stamp in this format 1374766406

I have tried to check with date('m-d-y H:i, $created) but than of course it is giving human readable output so don't know how to perform check if current time is not reached to 30min of created time.

Something like if(created > 30){}

Try this:

$created = // get value of column by mysql and save it here.

if ($created >= strtotime("-30 minutes")) {
    // its over 30 minutes old
}

You need to use strtotime(); to convert the date in human form back to a timestamp, then you can compare.

EDIT: Maybe I misread.

So something like;

if(($epoch_from_db - time()) >= 1800){
    //do something
}

The better approach is to use DateTime for (PHP 5 >= 5.3.0)

$datenow = new DateTime();
$datenow->getTimestamp();

$datedb = new DateTime();
$datedb->setTimestamp(1374766406);

$interval = $datenow->diff($datedb);
$minutes = $interval->format('%i');

$minutes will give you the difference in minutes, check here for more

http://in3.php.net/manual/en/datetime.diff.php

Here is the working code

http://phpfiddle.org/main/code/jxv-eyg