Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the 0-value timestamp date with Carbon

I am attempting to get the 0-value timestamp in an PHP API. I am currently using Carbon in a Laravel / Dingo API based system.

Is there a simple way to get the 0-value timestamp (presumably something like 01/01/1970) without hardcoding the date?

like image 570
AdamMcquiff Avatar asked Dec 19 '22 07:12

AdamMcquiff


1 Answers

You could try:

echo Carbon::createFromTimestamp(0)->toDateString();
// Displays: 1970-01-01

So you do not have to hardcode the date, just use a 0 timestamp.

like image 166
rap-2-h Avatar answered Jan 07 '23 05:01

rap-2-h