|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-12-28 12:46 UTC] a dot farhadi at gmail dot com
Description:
------------
The result of IntlDateFormatter::parse is integer and is limited to the integer range. (i.e. IntlDateFormatter::parse returns The least integer value (e.g. -2147483648 in 32-bit Platforms) when the result is out of the integer range.)
Reproduce code:
---------------
$fmt = new IntlDateFormatter("en_US", IntlDateFormatter::FULL, IntlDateFormatter::FULL);
var_dump($fmt->parse("Wednesday, January 20, 2038 3:14:07 AM GMT"));
Expected result:
----------------
float(2147570047)
Actual result:
--------------
int(-2147483648)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 00:00:01 2025 UTC |
Actually what I want to do is to convert dates between different calendars and to do so I'm using the returned timestamp with IntlDateFormatter::format method as follow: $df_persian = new IntlDateFormatter('en@calendar=persian', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tehran', IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd'); $df_gregorian = new IntlDateFormatter('en', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tehran', IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd'); echo $df_gregorian->format($df_persian->parse('1388-03-31')); Hopefully, format method accepts float values as argument and the only problem is parse method which doesn't return past-2038 timestamps. And by the way float precision loss wouldn't be a problem at least for timestamps up to 14 decimal digits.