[php-src] Issue #15809: [Question] Why is there no microseconds in date_create_from_format ?
| From: | zeriyoshi | Date: | Mon, 09 Sep 2024 10:06:54 +0000 |
| Subject: | [php-src] Issue #15809: [Question] Why is there no microseconds in date_create_from_format ? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247725@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/15809
Author: zeriyoshi
### Description
Hello,
It appears that
date_create_from_format uses the current time for date and time
components, but deliberately excludes microseconds.
```
$ php -r 'echo date_create_from_format("md", "0909")->format("Y-m-d
H:i:s.u"), \PHP_EOL;'
2024-09-09 10:05:01.000000
```
Looking at the source code, it seems that there's a condition that specifically avoids handling
microseconds. Does anyone know the reason for this? (Is it to prevent unintentionally creating
instances that are not equal?)
If there isn't a strong reason for this behavior, I think it might be worth considering
including microseconds in PHP 8.5. (Would this require an RFC?)