[php-src] Issue #11949: php `DateTime` not yet support nanosecond

From: Date: Sat, 12 Aug 2023 16:11:54 +0000
Subject: [php-src] Issue #11949: php `DateTime` not yet support nanosecond
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245162@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11949 Author: kocoten1992 ### Description Hi maintainer, While working on unrelated topic, I saw DateTime object do not support nanosecond yet: ```php // microsecond DateTime::createFromFormat("Y-m-d H:i:s.u O", '2023-08-12 09:10:14.152726 +0700'); // DateTime @1691806214 {#5222 // date: 2023-08-12 09:10:14.152726 +07:00, // } // nanosecond DateTime::createFromFormat('Y-m-d H:i:s.u O', '2023-08-12 09:10:14.152726478 +0700'); // false ``` [Carbon php](https://github.com/briannesbitt/Carbon) based on DateTime does support parsing but lost the detail in nanosecond. ```php Carbon::parse('2023-08-12 09:10:14.152726478 +0700'); // Carbon\Carbon @1691806214 {#5215 // date: 2023-08-12 09:10:14.152726 +07:00, // } ``` It would be great if DateTime support nanosecond :watch: , Carbon community will also benefit from this too.

« previous php.bugs (#245162) next »