Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abdallah-ghazal's avatar

Laravel Carbon return wrong date from timestamp

Hi, Could anyone help me to fix this issue : when I parse the timestamp which is coming from mobile using carbon it return's a wrong date when I compare carbon result with the results from https://www.epochconverter.com/ //the result from carbon

$date = Carbon\Carbon::createFromTimestamp(1641686520000); => Carbon\Carbon @1040548800 {#4857 date: 2002-12-22 09:20:00.0 UTC (+00:00), } // the result from https://www.epochconverter.com/ Sunday, January 9, 2022 12:02:00 AM

0 likes
2 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Try this (it seems that there are too many 00s)

$date = Carbon\Carbon::createFromTimestamp(1641686520000 / 1000); 

Please or to participate in this conversation.