DateTime->format(epoch) returning the wrong date

前端 未结 4 1974
春和景丽
春和景丽 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:17

    The problem I see is with your formatting.

    If you look at PHP's date function you can see that you just need to write each portion of the desired date & time into a string.

    The following formatting gives the same output you were looking for:

    $dt = new DateTime($supportDetails["Reported"]); $reportedTimeString = $dt->format('d/m/Y H:i:s \G\M\TP T');

提交回复
热议问题