My system timezone is UTC+3.
When I work with timestamp columns in MySQL, they are output for my timezone. So if a timestamp column has 00:00 UTC, it is shown as 03:00 for me.
I need to fill timestamp column with values using STR_TO_DATE
.
For example I do:
INSERT INTO `dates`(`created`)
VALUES (STR_TO_DATE('2016-11-01 00:00:00', '%Y-%m-%d %H:%i:%s'))
Inserted value is shown as it was: 2016-11-01 00:00:00
.
My conclusion is: STR_TO_DATE
considers its input to be in system timezone (UTC+3).
But I have datetime strings in UTC timezone. What should I do? The query is running inside Liquibase migration, so I can't use variables like @@global.time_zone
for timezone conversions.