1

I found that Asia/Yangon is running the wrong timezone. You can see below this picture.

TZE

But when I use Asia/Rangoon, it run the correct timezone that I want. Refer to this LINK, there is no Asia/Rangoon, only have Asia/Yangon. So what's the problem why I can't use Asia/Yangon, the website is write there...

*If you wonder why I will use Asia/Rangoon, I found it at here. Beside Yangon there is Rangoon.

time

kit
  • 1,166
  • 5
  • 16
  • 23

2 Answers2

4

The name Asia/Yangon was introduced in September 2016 with TZDB 2016g, where it became the canonical zone name for the time in Myanmar. At the same time, Asia/Rangoon was created as a link entry, making it an alias to preserve backwards compatibility. In other words, Asia/Rangoon is an alias for Asia/Yangon. They both refer to the time in Myanmar.

You can see this change in the tzdb sources here.

If your PHP installation does not recognize Asia/Yangon, then it has a TZDB release earlier to 2016g. PHP gets its TZDB information via the timezonedb PECL package. TZDB 2016g corresponds to timezonedb 2016.7, released on 2016-09-28.

PHP itself gets the latest version of timezonedb every time it puts out a release. Thus, your PHP installation is likely very old and simply needs to be updated.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
  • I have multiple servers running the same PHP version where some do and some don't support this timezone. So it seems it is not (only) depending on PHP version. – Lode Jan 19 '21 at 11:07
  • @Lode - I recommend you check the timezonedb version via [`timezone_version_get()`](https://www.php.net/manual/en/function.timezone-version-get.php) on your different servers. – Matt Johnson-Pint Jan 19 '21 at 19:51
  • Sadly that gives `0.system` in both cases. Outside of PHP I did find that the installed `tzdata` package has version differences: `2016d-1.el7` vs `2019b-1.el7`. Will try to update that. But good to know that PHP didn't define this. – Lode Jan 22 '21 at 11:18
  • Interesting. My understanding is that `0.system` is supposed to mean that it uses the version of timezonedb that PHP shipped with. Perhaps I am mistaken and it is actually using the tzdata of the system directly. I will check. Thanks! - And yes, update your system tzdata. ;) – Matt Johnson-Pint Jan 22 '21 at 17:31
  • @Lode - Are you using PHP's time zone APIs like `DateTimeZone`, or are you using PHP's ICU Intl APIs like `IntlTimeZone`? The former uses timezonedb, while the latter uses the ICU time zone data. – Matt Johnson-Pint Jan 22 '21 at 19:15
  • Using `DateTimeZone`. Btw, I updated `tzdata` with success. – Lode Feb 11 '21 at 22:09
-1

Time zone in Yangon, Myanmar (Burma) (GMT+6:30)

  $diffWithGMT=6*60*60+30*60; //converting time difference to seconds.
  $dateFormat="d-m-Y H:i:s";
  $timeAndDate=gmdate($dateFormat, time()+$diffWithGMT);//time() function returns the current time measured in the number of seconds since the Unix Epoch. 
  echo $timeAndDate; //time in Yangon

custom timezone can help.

read this time() and change time

Community
  • 1
  • 1
TeachMe
  • 535
  • 1
  • 5
  • 16