How to convert java timestamp to php timestamp?

前端 未结 8 1871
我寻月下人不归
我寻月下人不归 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:55

    Java gives you a timestamp in milliseconds. PHP uses Unix seconds, so divide by 1000:

      print(date("r", 1335997853142/1000)
    
    0 讨论(0)
  • it is not a java timestamp, it is milliseconds since epoch (1970-01-01 00:00:00 GMT)

    Which php supports too except in seconds so the following should work in php:

    date('choose your format', javaMilliseconds / 1000);
    
    0 讨论(0)
提交回复
热议问题