PHP:如何从数据库返回本地时间

I store the dates in my database in DATETIME type, looking as: Y-m-d H:i:s

What I want to achieve is to return the date from the database in the local time of the user. For example, if the user is in France, I will return his timezone. Is it possible to achieve this without storing the timezone of the user? Or if it is possible somehow else, and the storing format in the database needs to be changed, then I can do that. But, I am trying to achieve this without storing the user's timezone.

Well, the only way I can think of doing it without asking the user for their timezone is this:

<p>The time is: <span id="time" data="<?php echo strtotime($time_from_db); ?>"></span></p>
<script type="text/javascript">
    (function () {
        var t = document.getElementById('time'), d = new Date();
        d.setTime(t.getAttribute("data"));
        t.innerHTML = d;
    })();
</script>

This passes the datetime as a timestamp, which JS then applies locale (including timezone) to.

Store times in UTC in the database, and then do the timezone localization in your application. You will need to know the user's timezone, though.

If you store dates in GMT, then you can present them to the user on their timezones.

EDIT:

 date_default_timezone_set('UTC');
 $today = getdate();
 print_r($today);

Check this: php convert datetime to UTC and this: Convert UTC dates to local time in PHP and this: http://www.php.net/manual/en/function.gmdate.php