1

Can anyone please explain me this weird behaviour of these timestamps? There's an application that converts the timestamps to dates like this:

1184947071570 - 07-20-2007 11:57
1190394533377 - 09-21-2007 13:08

I cannot access the source code of that application. But I got the timestamps from the database, and when I convert to date using php this is what happens:

1184947071570 - 20 April 1955 13:17:54
1190394533377 - 27 October 1991 14:39:45

I used this code in php:

date("l, j F Y H:i:s", $timestamp)

The dates are completely different! How can I get the correct dates??

Thank you.

7
  • 2
    There's no way anyone will know what is causing this behavior without seeing code. Commented Feb 21, 2013 at 14:54
  • 1
    Are you sure these timestamps are definitely standard Unix timestamps? The first one points to a day in a year 39519. Commented Feb 21, 2013 at 14:56
  • your calculation isn't correct either TIME STAMP: 1184947071570 DATE (M/D/Y @ h:m:s): 06 / 24 / 19 @ 10:19:30pm EST Commented Feb 21, 2013 at 14:56
  • ummm...the first time stamp (with your code) is giving me Tuesday, 24 June 39519 23:19:30. The second is giving me Wednesday, 6 February 39692 07:09:37. Where are you getting 1955 and 1991 from? Commented Feb 21, 2013 at 14:58
  • $time1 = 1184947071570; $time2 = 1190394533377; echo date("l, j F Y H:i:s", $time1)."<br />"; echo date("l, j F Y H:i:s", $time2); This was the code I used to get my result. What are you using? Commented Feb 21, 2013 at 14:59

3 Answers 3

8

The timestamps you have include milliseconds. If you divide your timestamps by 1000 you will get the correct times.

echo date('l, j F Y H:i:s', 1184947071570 / 1000);
Sign up to request clarification or add additional context in comments.

Comments

2

They are not seconds like UNIX timestamps.

They are milliseconds devide it by 1000 and try again

Comments

0

I've just made some tests and your db timestamp has some additional characters.

Timestamp for 07-20-2007 11:57 is 1184947020

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.