'Laravel convert timestamp into date with specific timezone

I am saving my timestamp in Laravel using the following.

Carbon::now()->timestamp;

How do you convert a timestamp into a specific time format with a specific timezone (using Carbon)?

$unix_time_stamp = "1572095520";
$date = Carbon::createFromTimestamp($unix_time_stamp);
$date->setTimezone('Pacific/Auckland')->format('Y-m-d H:i:s');

I am getting incorrect result on this one, should be Oct 27



Solution 1:[1]

Go to config -> app.php and change 'timezone' => 'Pacific/Auckland',

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aravinth E