I would like to print the time in local time in Laravel. If the user create a post it will display the created time on the server. How can I display it in local time ?
$dt = new DateTime($posts->updated_at);
$tz = new DateTimeZone('Asia/Kolkata'); // or whatever zone you're after
$dt->setTimezone($tz);
echo $dt->format('Y-m-d H:i:s');