You are here: Re: arithmetics with timestamp? « PHP Programming Language « IT news, forums, messages
Re: arithmetics with timestamp?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация