How to get the current timestamp in Laravel

Laravel utilizes the Carbon package. It is an API extension for DateTime in PHP. The current time can be fetched with Carbon by using the now() method. This will equal the current time in YYY-mm-dd HH:mm:ss format

use CarbonCarbon;


$now = Carbon::now();

This will get the current timestamp.

$now = Carbon::now()->timestamp;