-1

I am receiving milliseconds UNIX timestamp from google and I need to convert them into actual date (not date time just date).

How can I do that with carbon?

all my search results ware datetime to milliseconds instead of milliseconds to date.

sample of data i receive:

"startTimeMillis" => "1580000000000",
"expiryTimeMillis" => "1580000000000",

I need to convert these to dates like 2020-06-26.

mafortis
  • 6,750
  • 23
  • 130
  • 288

1 Answers1

0

you can use function createFromTimestampMs

and return with format you need format()

$millesecondsTimestamp = 1691915427814;
$date = Carbon::createFromTimestampMs($millesecondsTimestamp);
return $date->format('Y-m-d');
Daizygod
  • 32
  • 1
  • 3
  • because question being duplicate ! – OMi Shah Aug 13 '23 at 08:43
  • @mafortis I think maybe millesecond time it`s very important for you, and you text that you need do this in with Carbon, check docs good luck! https://carbon.nesbot.com/docs/ – Daizygod Aug 13 '23 at 08:44