How to set the time zone (php)

How to make your php application is using different time zone then server. Can use the script as below.

<?php
date_default_timezone_set("Asia/Kuala_Lumpur");
$time_offset ="0"; // Change this to your time zone
$time_a = ($time_offset * 120);
$time = date("h:i:s",time() + $time_a);
echo 'Current time is : '.$time;
?>

Leave a Reply

Your email address will not be published. Required fields are marked *