Re: Unix time
| From: | Justin French | Date: | Thu, 23 May 2002 10:14:45 +0000 |
| Subject: | Re: Unix time | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98888@lists.php.net to get a copy of this message | ||
It'd help if you showed us some code.
If you've got a unix time stamp in your MySQL db, then all you need to do is
compare it to your local server time using time().
Easy.
<?
$then = "1021877476"; // your unix timestamp stored in MySQL
$now = time(); // current time stamp
$difference = $now - $then; // in seconds
?>
If your date is stored in YYY-MM-DD format, you'll have to convert it to a
unix time stamp first (can be done in query, or using strtotime()).
Justin
on 23/05/02 8:06 PM, Cosmin (cosmin@grafx.ro) wrote:
> Hello
>
> How can I compare Unix Time?
> As integer values?
> I take the unix time from database and I compare with the current time
> and something is not functioning. Can somebody show me how can I do this?
>
> Thank you ,
> Cosmin
>
>
>
>