The code is not working as expected, please help. I want to display the time that I grab from the database as UTC into browser time.
`Latest data at:
latest_data_timestamp”;
$time = strtotime($utc);
echo ” “. date(“Y-m-d H:i:s”, $time).”
“;
?>
`
2
Answers
For this you have to store the user’s timezone in your DB. If you are not storing the TimeZone the you have to perform with Javascript.
To convert UTC time to the user’s browser time in Laravel Blade, you can use JavaScript to handle the conversion client-side. Here’s a simple example of how you can achieve this: