Posted by David Haynes on 07/07/06 11:50
Hoopster wrote:
> I'm creating a script to include time.
>
>
> Here is my code.
>
> <?php
> echo date("H:i:s");
> ?>
>
>
> However, my server is 2 hours difference from me. What is the exact
> command that I can use to offset it.
>
>
> Please provide me with an exact code change as I'm new at this.
>
>
> Thanks
As others have pointed out, you could just add 2 hours (in seconds) to
the offset but what about daylight saving time?
A better way is to set the timezone value.
e.g.
// save the current timezone
$my_tz = date_default_timezone_get();
// set the new timezone
date_default_timezone_set('America/New York');
// display the time and timezone
echo date('H:i:s T');
-david-
Navigation:
[Reply to this message]
|