Converting a datetime field timestamp from mysql to php

前端 未结 2 1789
执笔经年
执笔经年 2020-12-12 08:08

I have read about how to do this and most come up with this solution. I just want to display the time format.

$starttime = \"1899-12-30 06:52:47\";


        
2条回答
  •  感动是毒
    2020-12-12 08:39

    As mentioned in the comments your date is before the unix epoch. DateTime() allows you to work around that.

    $dt = new DateTime("1899-12-30 06:52:47");
    echo $dt->format("h:i:s");
    

提交回复
热议问题