【发布时间】:2017-02-24 15:35:45
【问题描述】:
鉴于这个简单的表格:
create table comments (
id numeric not null,
comment text,
created timestamp not null default now()
);
在我的电脑上直接在数据库上使用 dbeaver,并执行此语句
insert into comments (id, comment)
select 1111, 'test';
新记录的“created”字段为:2017-02-24 16:17:21
这是我的正确时间 (CET)。
当我从 php 脚本(在连接到数据库的基于 linux 的网络服务器上运行)运行相同的语句时,结果是 2017-02-24 15:17:21。
linux服务器时间没问题(即CET)。
我错过了什么?
【问题讨论】:
-
在您的 PHP ini 文件中,检查选定的时区。编辑:其实不太清楚为什么这很重要
-
听起来你错过了大约一个小时
-
@pteronewone 是一个很好的 :)
-
@Andy 我已经尝试设置 date_default_timezone_set('CET');
标签: php linux postgresql dbeaver sql-timestamp