Dates
Posted: Wed Jun 22, 2005 3:13 pm
How could I take a unix timestamp in php and add 4hours to it?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$modified = strototime('+4 hours',$original);In reply to his cross post...blazer21 wrote:PHP v5.0.2
When running the following code date always returns 04:00:00 for the time and not 4 hours past the current time?
Code: Select all
echo $date('m/d/Y h:i:s', strtotime('+4 hours', time()));
Code: Select all
echo date('m/d/Y h:i:s', strtotime('+4 hours'));Code: Select all
echo date('m/d/Y h:i:s', (time()+14400));Code: Select all
echo date('h:i:s', (time()+14400));Code: Select all
function strtotimefix($strtotime)
{
return time() + (strtotime($strtotime) - strtotime('now'));
}