Bug #50590 [Asn]: IntlDateFormatter::parse result is limited to the integer range

From: Date: Mon, 21 Jun 2010 07:59:42 +0000
Subject: Bug #50590 [Asn]: IntlDateFormatter::parse result is limited to the integer range
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151714@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=50590&edit=1 ID: 50590 User updated by: a dot farhadi at gmail dot com Reported by: a dot farhadi at gmail dot com Summary: IntlDateFormatter::parse result is limited to the integer range Status: Assigned Type: Bug Package: I18N and L10N related Operating System: Ubuntu PHP Version: 5.3.1 Assigned To: stas New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2010-06-21 01:42:27] stas@php.net Out of curiosity - how do you expect to use past-2038 timestamps? Many Unix systems won't support those. Do you expect 64-bit value or some other way? float might be not very good for it due to the precision loss. ------------------------------------------------------------------------ [2009-12-28 12:46:06] 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) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=50590&edit=1

« previous php.bugs (#151714) next »