Announcement

Collapse
No announcement yet.

Offset time in PHP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Offset time in PHP

    Hi, I need to call the current time for my site, but I want it to be in my local time, GMT+10.

    I'm currently using:

    PHP Code:
    <? print date("g:i A"); ?>
    and
    PHP Code:
    <? print date("l j F Y"); ?>
    What exactly do I need to add to this to make it offset to the appropriate timezone?

    Better yet, how could I easily call the time from vBulletin to my main page?

    Thanks!
    Last edited by Agent Richard; Sun 4th Apr '04, 5:06pm.

  • #2
    Adding 10 hours to the GMT

    Is this something like what you would like to do?

    PHP Code:
    <?php
    $currentGMT 
    gmmktime ();
    $oneMinute 60;
    $oneHour $oneMinute 60;
    $GMTOffset 10;
    $localTime $currentGMT + ($GMTOffest $oneHour);
    print 
    date("g:i A"$localTime);
    print 
    date("l j F Y"$localTime);
    ?>

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X