0

I work with php 7.1.4 and when I do an echo of the date () function with the integer 1540193140046 it returns a malformed value (view image). However if I do the same thing using this tool it returns the correct value: Monday, 22 October 2018 7:25:40.046

What is the reason?

enter image description here

kusflo
  • 61
  • 9

1 Answers1

2

PHP timestamps are in seconds, whereas that tool when it sees the big number says:

Assuming that this timestamp is in milliseconds

try

echo date('Y-m-d H:i:s', 1540193140046/1000);

and you will get the answer you expect:

2018-10-22 09:25:40
Nick
  • 138,499
  • 22
  • 57
  • 95