# Change timezones in php

**URL:** <https://forum.kirupa.com/t/change-timezones-in-php/293956>\
**Category:** Uncategorized\
**Created:** [August 6, 2009, 9:31am UTC](https://forum.kirupa.com/t/change-timezones-in-php/293956 "2009-08-06T09:31:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilbertsavier](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@gilbertsavier](https://forum.kirupa.com/u/gilbertsavier)\
**Post date:** [August 6, 2009, 9:31am UTC](https://forum.kirupa.com/t/change-timezones-in-php/293956/1 "2009-08-06T09:31:16Z")

</div>

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") . "  
";

// convert to IST  
$d-\>convertTZByID(“PST”);

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

?\>
