我有一个laravel应用程序,我正在尝试将用户签入和签出保存到我的数据库
我有一个模型Checkins,我记录它像created_at和updated_at
在我的本地主机上它保存了我的timezome(埃及)的正确时间,我试图将app.php文件更改为以下
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
| This is a bad thing really i think there is a problem within the server, the datetime
*/
'timezone' => 'EET',
Run Code Online (Sandbox Code Playgroud)
它在我的本地主机上工作得很好,并保存在当前正确的时间,生产它与UTC时区一起保存
此外,当我在生产终端写入命令日期时date,我得到以下内容
Tue Mar 31 12:46:38 EET 2015
Run Code Online (Sandbox Code Playgroud)
我检查了mysql的时区,我发现它从系统时间得到的时间
SELECT @@global.time_zone, @@session.time_zone;
SYSTEM
Run Code Online (Sandbox Code Playgroud)
这有什么不对?
我创建了一个php页面,date('H:i:s');并且打印出正确的时间
要设置Laravel应用的时区,请更改'timezone'您的config/app.php
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
| This is a bad thing really i think there is a problem within the server, the datetime
*/
'timezone' => 'America/Los_Angeles',
Run Code Online (Sandbox Code Playgroud)
你可以在这里找到你需要的时区.
| 归档时间: |
|
| 查看次数: |
9546 次 |
| 最近记录: |