PHP time () function returns random time shift by hour

I have PHP code that inserts a date into a table:

INSERT INTO tblEventLog VALUES  ...  date("Y-m-d H:i:s",time())  ...

The results of this are usually correct, but the random date is an hour behind:

315070  05-Sep-10 18:08
315069  05-Sep-10 18:07
315068  05-Sep-10 18:07
315067  05-Sep-10 18:06
315066  05-Sep-10 18:06
315065  05-Sep-10 17:04
315064  05-Sep-10 18:01

What could be the reason for this? There is only one server.

EDIT:
Using NOW () worked!
The problem was that one of the PHP pages changed the time zone (when creating the RSS feed), and the PHP time () function collected this. Using a database to set time-fixed things.

+3
source share
1 answer

, . DATETIME, , MySQL NOW(), PHP. , . .

+2

Source: https://habr.com/ru/post/1763348/


All Articles