Req #81644 [Com]: mysql native driver should use DateTime object

From: Date: Sat, 20 Nov 2021 21:10:16 +0000
Subject: Req #81644 [Com]: mysql native driver should use DateTime object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237884@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81644&edit=1 ID: 81644 Comment by: shop1 at mokraemer dot de Reported by: shop1 at mokraemer dot de Summary: mysql native driver should use DateTime object Status: Open Type: Feature/Change Request Package: MySQLi related Operating System: Linux PHP Version: 8.0.13 Block user comment: N Private report: N New Comment: Thanks for your comment. You're right about Date/Time we don't have anything in php for that. For datetime and timestamp there is no problem with timezones. The conversion is done by mysql on the connection base. Anyway, now everyone who uses DateTime or timestamps from mysql in php needs to do convert that column to a DateTime object in order to do anything with the value from the database. But maybe you're right this needs some more thinking and an RFC. Since RFC's are not easy to make for php, I guess this is the end of that idea. Previous Comments: ------------------------------------------------------------------------ [2021-11-20 11:47:44] heiglandreas@php.net As PHP - at least currently - does not have native types for Date and Time there will be no possibility to convert those into Objects. And I don't even want to tackle the topic of converting Datetime values with regards to timezones. As there is no "One size fits all" it is best to leave that up to the app. And as the native mysqli driver only converts between native types I doubt that that is a thing that we should start. If so, we would for sure need an RFC for that. ------------------------------------------------------------------------ [2021-11-20 10:56:07] shop1 at mokraemer dot de Description: ------------ if you use mysqli native driver, it fetches data and puts the data in the equivalent php datastructure. This is true for float, int, ... But values for date,time and datetime are still strings. It would be great if this is converted automatical. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81644&edit=1

« previous php.bugs (#237884) next »