Save CURRENT_TIMESTAMP as GMT

My server is in Los Angeles, but I want my CURRENT_TIMESTAMP to be GMT. Can I set this automatically or should I send the GMT value to the insert or update statement?

+3
source share
4 answers

Set the server’s time zone to GMT, set the MySQL server’s time zone to GMT in its my.cnf configuration file, or set the MySQL connection time zone using the SET query before starting any other queries, however you go about it, you don’t have to do it yourself in every request.

http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html

-. .

+1

. : http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html

, SET time_zone = YOURTIMEZONEGOESHERE;, NOW() ( CURRENT_TIMESTAMP.

, UTC . .

0

You immediately see the Php date method .

This is exactly what you need.

$timestamp = 67427423473;

echo date ('M d YH: i: s O', $ timestamp)

0
source

Using:

UTC_TIMESTAMP

Instead:

CURRENT_TIMESTAMP

0
source

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


All Articles