Convert a unix timestamp to a human readable date in PHP?

后端 未结 2 784
名媛妹妹
名媛妹妹 2021-01-17 18:41

I have a timestamp value from PHP: 1188604800000

When I format the time to human readable like this:

date(\"m/d/Y\", 1188604800000)
         


        
2条回答
  •  误落风尘
    2021-01-17 18:50

    PHP uses seconds-based timestamps, so divide 1188604800 by 1000 and you are good.

    php> echo date('Y-m-d', 1188604800000/1000);
    2007-09-01
    

提交回复
热议问题