Home

Tuesday, January 17, 2012

How to convert time according to timezone in php

///Your time zone mention here
$myDateTime = new DateTime('2012-01-12 11:23', new DateTimeZone('Asia/Kolkata'));

///Want to desire time
$myDateTime->setTimezone(new DateTimeZone('Australia/Sydney'));

/* Like another Example */
//$myDateTime->setTimezone(new DateTimeZone('Asia/Baku'));
//$myDateTime->setTimezone(new DateTimeZone('Europe/London'));


echo $myDateTime->format('Y-m-d h:i');?>


No comments:

Post a Comment

rathoddhirendra.blogspot.com-Google pagerank and Worth