Converting facebook time to human readable time with PHP

后端 未结 1 751
离开以前
离开以前 2021-01-22 12:55

I retrieved this time value from facebook: 1438306200

How do I convert it to human readable format with PHP?

I tried: date(\'Y-m-d H:i:s\', strtotime( 1         


        
1条回答
  •  情话喂你
    2021-01-22 13:29

    There's no need for the strtotime( ) call, it's already a timestamp:

    Edit: the other date you received (1970-1-1) is the Unix Epoch, which is the first date PHP is able to return. strtotime( '1438306200' ) equals 0 as what you passed is a time stamp, not a string. Passing 0 to date effectively means "0 seconds from epoch", which results in 1970-1-1 being returned. Just so you know ;)

    0 讨论(0)
提交回复
热议问题