PHP How to return datetime(6) from Mysql?

前端 未结 6 1852
隐瞒了意图╮
隐瞒了意图╮ 2020-12-17 10:37

When I query a dateTime(6) PHP is truncating my 6 fractional seconds.

Here is an example of my php code:

$sql = \'SELECT date FROM tbl\';
        $         


        
6条回答
  •  無奈伤痛
    2020-12-17 11:36

    It's crazy this still isn't officially supported by mysqli in PHP 7.1, but anyway, here's a work around.

    select concat(`DateTime6`)`DateTime6` from ...
    

    Basically casting it as a string worked for me, as ugly as that is.

提交回复
热议问题