@ 2015-09-16T11:12:02Z <?php
$intlDateFormatter = new IntlDateFormatter(
'en_US',
IntlDateFormatter::MEDIUM,
IntlDateFormatter::NONE,
'Asia/Nicosia',
IntlDateFormatter::GREGORIAN,
'yyyy-MM-dd HH'
);
$intlDateFormatter->setLenient(false);
$date = '1990-03-24 01';
$res = $intlDateFormatter->parse($date);
echo "$date - $res\n"; // 1990-03-24 - 638229600
$date = '1990-03-25 01';
//$intlDateFormatter->setLenient(true);
$res = $intlDateFormatter->parse($date, $pos);
var_dump($res);
var_dump($pos);
var_dump($intlDateFormatter->getErrorCode());
var_dump($intlDateFormatter->getErrorMessage());
echo "$date - $res\n"; // 1990-03-25 -
$date = '1990-03-26 01';
$res = $intlDateFormatter->parse($date);
echo "$date - $res\n"; // 1990-03-26 - 638398800
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.2.0 - 7.2.33 , 7.3.16 - 7.3.31 , 7.4.0 - 7.4.32 , 8.0.0 - 8.0.12 , 8.0.14 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 1990-03-24 01 - 638233200
int(638316000)
int(13)
int(0)
string(12) "U_ZERO_ERROR"
1990-03-25 01 - 638316000
1990-03-26 01 - 638402400
Output for 8.0.13 Fatal error: Uncaught Error: Class "IntlDateFormatter" not found in /in/APnNV:3
Stack trace:
#0 {main}
thrown in /in/APnNV on line 3
Process exited with code 255 . Output for 7.3.32 - 7.3.33 , 7.4.33 Fatal error: Uncaught Error: Class 'IntlDateFormatter' not found in /in/APnNV:3
Stack trace:
#0 {main}
thrown in /in/APnNV on line 3
Process exited with code 255 . Output for 5.5.17 , 5.6.0 - 5.6.38 , 7.0.0 - 7.0.32 , 7.1.0 - 7.1.24 1990-03-24 01 - 638233200
int(638316000)
NULL
int(0)
string(12) "U_ZERO_ERROR"
1990-03-25 01 - 638316000
1990-03-26 01 - 638402400
Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.16 , 5.5.18 - 5.5.38 Fatal error: Class 'IntlDateFormatter' not found in /in/APnNV on line 3
Process exited with code 255 . preferences:dark mode live preview
234.22 ms | 402 KiB | 331 Q