Wednesday, September 3, 2008

How to change time zone using php - set default timezone for php

Surely when you develop a site, you need to change current server timezone to a different timezone for client requirements.
You can use date_default_timezone_set() to set default timezone for a given script. You can also edit the php.ini to change the timezone for all projects.

You can find list of supported timezones HERE for the above function


//before use of date_default_timezone_set

echo date("d-m-Y h:i:s A");

echo '<br /><br />';

//set to US central time

echo date("d-m-Y h:i:s A");


Get Free Sinhala IT Learning Videos

Freelance Jobs