Re: Date Calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Friday, October 29, 2004, 4:51:20 AM, you wrote:
MT> I have a shell script that inserts the unix date and time that the 
MT> script ran into a MySql database. For example Thu Oct 28 13:41:33 CDT 
MT> 2004. I would like to have my web page do the math so that it displays 
MT> the time since the script ran. How can I do the math so that the web 
MT> page will display something like the script ran 1500 seconds ago.


MT> Thanks,

MT> mike


You can do something like this (replace date with column name no quotes)

$result = mysql_query("SELECT SEC_TO_TIME(UNIX_TIMESTAMP() - UNIX_TIMESTAMP('2004-10-01 13:45:00')) as diff");

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux