DateTime->format(epoch) returning the wrong date

前端 未结 4 1964
春和景丽
春和景丽 2021-01-22 04:55

I am working on a project and I am having an issue formatting an epoch time to a human readable time.

I have the following epoch time 1428512160 and when I

4条回答
  •  后悔当初
    2021-01-22 05:14

    Try the following code:

    $reportedTimeString = date("d-m-Y H:i:s", $supportDetails["Reported"]);

    Or the following:

    $date = new DateTime();
    $date->setTimestamp($supportDetails["Reported"]);
    $reportedTimeString = $date->format("d-m-Y H:i:s");
    

提交回复
热议问题