How to convert java timestamp to php timestamp?

前端 未结 8 1873
我寻月下人不归
我寻月下人不归 2020-12-20 18:02

how can I convert a Java timestamp like this one 1335997853142 to a format that php can read? 1335997853142 should be 02 May 2012 22:30:53

8条回答
  •  攒了一身酷
    2020-12-20 18:52

    The timestamp you have is in milliseconds when it should be in seconds

    $java_time = 1335997853142;
    $php_time = $java_time / 1000;
    $today = date("d M Y G:i:s", $php_time);
    

    Output

    02 May 2012 22:30:53
    

提交回复
热议问题