php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70518 Unexpected behaviour for en-GB within IntlDateFormatter
Submitted: 2015-09-17 11:05 UTC Modified: 2016-04-08 07:39 UTC
From: gavin at usemarkup dot com Assigned: ab (profile)
Status: Closed Package: intl (PECL)
PHP Version: 5.5Git-2015-09-17 (snap) OS: N/A
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gavin at usemarkup dot com
New email:
PHP Version: OS:

 

 [2015-09-17 11:05 UTC] gavin at usemarkup dot com
Description:
------------
Unexpected behaviour for en-GB within IntlDateFormatter.

en-GB seems to render the display as a.m. for some reason? 

See output here.
https://3v4l.org/npHgN

Test script:
---------------
<?php

$date = new DateTime(null, new DateTimeZone('Europe/London'));

$france = new \IntlDateFormatter(
    'fr_FR',
    \IntlDateFormatter::NONE,
    \IntlDateFormatter::NONE,
    $date->getTimezone()
);

$uk = new \IntlDateFormatter(
    'en_GB',
    \IntlDateFormatter::NONE,
    \IntlDateFormatter::NONE,
    $date->getTimezone()
);

$us = new \IntlDateFormatter(
    'en_US',
    \IntlDateFormatter::NONE,
    \IntlDateFormatter::NONE,
    $date->getTimezone()
);

echo $france->format($date) . PHP_EOL;
echo $uk->format($date) . PHP_EOL;
echo $us->format($date) . PHP_EOL;
echo $date->format('F j, Y, g:i a');

Expected result:
----------------
20150917 11:47 AM
20150917 11:47 am
20150917 11:47 AM
September 17, 2015, 11:47 am

Actual result:
--------------
20150917 11:47 AM
20150917 11:47 a.m.
20150917 11:47 AM
September 17, 2015, 11:47 am

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-08 07:39 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-04-08 07:39 UTC] ab@php.net
Thanks for the report. This is unlikely an issue in PHP as all the formatting happens in ICU. You can try the latest ICU versions, fe with 57.1 i don't reproduce this behavior.

Thanks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 12:01:28 2025 UTC