PHP How to return datetime(6) from Mysql?

前端 未结 6 1896
隐瞒了意图╮
隐瞒了意图╮ 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:17

    You can format it to include it. The %f includes the six-digit microseconds.

     SELECT DATE_FORMAT(date, '%Y-%m-%d %H:%i:%s.%f') FROM tbl
    

提交回复
热议问题