1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP change timezones in php

Discussion in 'Web Development' started by gilbertsavier, Jul 14, 2009.

  1. gilbertsavier

    gilbertsavier New Member

    Hi,
    PHP scripting language have an built in function to change between the timezones , you will need the PEAR package . In the following example show you how to convert from GMT system format to IST Format .

    <?php
    // include class
    include ("Date.php");

    // initialize object
    $d = new Date("2008-10-03 16:23:48");


    // set server time zone
    $d->setTZByID("GMT");

    // print server time
    echo "Local time is " . $d->format("%A, %d %B %Y %T") . "\n";

    // convert to IST
    $d->convertTZByID("PST");

    // output converted date/time
    echo "Destination time is " . $d->format("%A, %d %B %Y %T");

    ?>

    _________________
    Thanks & regards
    Lokananth
     
  2. soka

    soka New Member

    can we not change the timezone in cpanel ?