DateTimeZone error: Unknown or bad timezone

Posted by Falya on Stack Overflow See other posts from Stack Overflow or by Falya
Published on 2011-01-31T06:46:08Z Indexed on 2011/01/31 7:26 UTC
Read the original article Hit count: 241

Filed under:

I am trying to run this script:

<?php
$d = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$time = $d->format('H:i');

echo $time;
?>

but I got this error:

Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() [<a href='function.DateTimeZone---construct'>function.DateTimeZone---construct</a>]: Unknown or bad timezone (Asia/Kolkata)

Though it works well for Asia/Dacca for example. What could be the problem and how to fix it?

© Stack Overflow or respective owner

Related posts about php