2

My app suddenly started to display a wrong timeZone format. I always had '12/11/2018 3:55 AM AEST' as the output but now it returns '12/11/2018 3:55 AM GMT+11'. The code:

$formatter = new IntlDateFormatter('en-US', IntlDateFormatter::NONE, IntlDateFormatter::NONE, 'Australia/Sydney', null, "dd/MM/yyyy h:mm a z");
echo $formatter->format(new DateTime());

Is there a simple way to fix that?

I'm using php7.0 with the intl extension and ICU version 60.2 Ubuntu 18.04

Pavel Bariev
  • 2,546
  • 1
  • 18
  • 21

1 Answers1

0

Change the country code to Australia (en_AU).

Using the US country code (en_US), people in the US are not likely to know what AEST means or may confuse it with the US's Eastern Standard Time. At some point, the ICU devs likely decided to show other country's time zones as an offset to prevent confusion.

$formatter = new IntlDateFormatter(
    'en_AU',
    IntlDateFormatter::NONE,
    IntlDateFormatter::NONE,
    'Australia/Sydney',
    null,
    "dd/MM/yyyy h:mm a z"
);
echo $formatter->format(new DateTime());
// 12/11/2018 3:55 AM AEST
Jim
  • 3,210
  • 2
  • 17
  • 23