DEV Community

Alexander6
Alexander6

Posted on

A confusing problem of the Mysql timestamp

Background

when I synced data using Navicat from local to RDS, I found the SQL query results with order by create_time DESC was incorrect.
I guessed that may be relative to the SQL client's time_zone setup, cause I have met such a problem before when I work as a Frontend Engineer.
So I decided to dig into this issue and get the proper resolution.

Firstly

, look at the time_zone setup of your Mysql client using this command

show variables like '%time_zone%'.
Enter fullscreen mode Exit fullscreen mode

result of my local Mysql client

Image description

result of RDS

Image description

The time_zone setup is absolutely different!. Let's make a query by SELECT create_time FROM order_deposits WHERE id=37;

result of local

Image description

result of RDS

Image description

The result of this query is absolutely the same.

Top comments (0)