0

If i use

<?php
date_default_timezone_set('Asia/Dhaka');
?>

as default timezone to a page of my website. And if I echo this on this page: echo date_default_timezone_get()." ".date('Y-m-d H:i:s'). A user from America/Los_Angeles will find the date?

Bla Bla
  • 49
  • 1
  • 10
  • Why don't you use UTC as default timezone and convert that in client side. In that way every user will get the time in their local time – Peshraw H. Ahmed May 27 '18 at 20:43

1 Answers1

1

There is nothing built-in to PHP that can detect the client's time zone. Instead, you'll need to detect the user's time zone in JavaScript. You can then send that string to the server, and pass it into PHP's various time zone functions.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575