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

kekekiw123's avatar

Carbon unix timestamp

I have a int field that I store dates as unix timestamp like:

strtotime(Carbon::now()->addMonths(2));

But does Carbon have any function to store timestamps as integers so that I dont have to use strtotime() ?

0 likes
2 replies
d3xt3r's avatar
dd(Carbon::now()->timestamp);
5 likes
Snapey's avatar
Snapey
Best Answer
Level 122
Carbon::now()->addMonths(2)->timestamp;
11 likes

Please or to participate in this conversation.