|
Posted by Janwillem Borleffs on 01/15/06 19:30
Super Mango wrote:
> Say that I have this value in a variable -
> 1) how do I get the current system timestamp?
> 2) how do I subtract the first from the second?
>
If you are only interested in the amount of hours, you could do something
like:
$now = time();
$past = time() - 86400;
print 'The difference between $past and $now = ';
echo ($now - $past) / 3600, ' hours';
Of course, you can narrow this figure down to days (div 86400), hours (div
3600), minutes (div 60) and seconds.
These kind of calculations can also be performed by MySQL. Have a look at
the manual @ mysql.com for more info.
JW
Navigation:
[Reply to this message]
|