note 52061 deleted from function.date by derick
| From: | derick@php.net | Date: | Sun, 11 Jun 2006 11:34:29 +0000 |
| Subject: | note 52061 deleted from function.date by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-114227@lists.php.net to get a copy of this message | ||
Note Submitter: php at webparlour dot com
----
This may be ULTRA SIMPLISTIC, but having this example would have saved me (a PHP newbie) some time
trying to figure out how to adjust the local server time to a different local time.
Essentially, I started out with:
$appdate = date("F jS Y, h:iA.");
Which captures the *local server time* in $appdate:
April 20th 2005, 04:44AM.
BUT...
The *local time* I needed reflected in the variable is 3 hours later. To accomplish this very
simply, add the "time()" modifier like so:
$appdate = date("F jS Y, h:iA.", time() + 10800);
Which captures the *ADJUSTED local server time* in $appdate:
April 20th 2005, 07:44AM.
So, adding " time() + 10800" to the normal Date() function ADDS 3 hours (10800 seconds!)
to the local server time.
Hope this helps others struggling to make this very basic adjustment.
Cheers,
Jem