Why does the int type Time field in MySQL differ by 8 hours?

Source: Internet
Author: User
I am in the vendor's client software to view the time of each record is normal, but I directly in the background using SQLyog lookup, found that their query out of the time field is always 8 hours slower, ask what is the problem?

I use the following statement, out of the format is 2013-05-25th 01:37:08, in fact, the correct time for the record is 2013-05-25th 09:37:08


SELECT date_format (from_unixtime (' table '. ' Time '), '%y-%m-%d%h:%i:%s ') as ' thetime ' from table


Reply to discussion (solution)

Related to your server's time zone settings

But the vendor's client software looks no problem.

If there is no way, in MySQL how to add the current time 8 hours, and then the int type of Time field in the format of 2013-05-25th 01:37:08 display.

The MySQL server has several time zone settings:

· The system time zone. When the server starts, it attempts to determine the host's time zone, which is used to set the System_time_zone system variable.

· The current time zone of the server. The global system variable Time_zone represents the time zone that the server is currently using. The initial value is ' system ', which indicates that the server time zone is the same as the system time zone. You can explicitly specify an initial value with the--default-time-zone=timez option. If you have super privileges, you can set the global variable value at run time using the following statement:

· mysql> SET GLOBAL time_zone = timezone;
· The time zone for each connection. Each client connection has its own time zone setting, given by the session Time_zone variable. Its initial value is the same as the global variable time_zone, but it can be reset with the following statement:

· mysql> SET time_zone = timezone;
You can query the current global variable values and the time zone for each connection in the following ways:

Mysql> SELECT @ @global. time_zone, @ @session. Time_zone;
The timezone value is a string that represents the offset of UTC, such as ' +10:00 ' or ' -6:00 '. You can also use a named time zone, such as ' Europe/helsinki ', ' us/eastern ' or ' MET ', if you have already created and mounted a time zone related table in the MySQL database. The value ' system ' indicates that the time zone should be the same as the system time zone. The time zone name is not case sensitive.

SELECT @ @global. time_zone, @ @session. time_zone

Two fields are display system

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.