Search code examples
phplaravelphp-carbon

Display current timezone like this +03:00 in Laravel


$timezone = Carbon::now()->format('e'); // Asia/Riyadh

Instead of Asia/Riyadh I would like +03:00 to be printed.


Solution

  • $timezone = Carbon::now()->format('P');
    

    https://www.php.net/manual/en/datetime.format.php