Convert Unix Timestamp to Carbon Object

Chintan7027 picture Chintan7027 · Feb 28, 2017 · Viewed 74.2k times · Source

I have unix timestamp in table, wants to show to user using Carbon. How can I achieve ?

e.g.

1487663764.99256
To

2017-02-24 23:23:14.654621

Answer

surgiie picture surgiie · Feb 28, 2017

Did you check the carbon docs? I think this is what youre looking for:

Carbon::createFromTimestamp(-1)->toDateTimeString(); 

Checkout http://carbon.nesbot.com/docs/#api-instantiation