문제

Can i convert GMT to IST in PHP without using PEAR.

Here is how i get GMT gmdate(), now how do i convert it to IST.

Thanks

도움이 되었습니까?

해결책

try

 echo date('Y-m-d H:i:s',strtotime('+330 minutes', 0));  

or

  date_default_timezone_set('Asia/Kolkata');
  echo date('Y-m-d H:i:s');  

first get time by

 $time = new DateTime('now', new DateTimeZone('UTC'));
    // than convert it to IST by
    $time->setTimezone(new DateTimeZone('IST'));

다른 팁

Easy-peasy:

$date = new DateTime('2012-11-04 05:04:00', new DateTimeZone('GMT'));
$date->setTimezone(new DateTimeZone('IST'));

echo $date->format('Y-m-d H:i:s');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top