...

View Full Version : How do i add 5 hours to PHP Time Code



mobimad
10-30-2009, 03:57 PM
Hi Guys / Girls

I have a php date and time that im using which is

"F d Y, H:i"

but this is using the time from the server in US and i'm in UK, so how can i add 5 hours to the time to be correct for me.

Thanks in-advance for your help

P.S i'm a php newbie i'm afraid !!!

Jenna

er4o
10-30-2009, 04:18 PM
Something like this, maybe?

echo date("F d Y, H:i", strtotime("+5 hour"));

or

echo date("F d Y, H:i", (time() + (5 * 60 * 60)));

abduraooft
10-30-2009, 04:21 PM
date_default_timezone_set() (http://php.net/manual/en/function.date-default-timezone-set.php)

Phil Jackson
10-30-2009, 07:50 PM
strtotime() for php4



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum