Home > Database > Mysql Tutorial > mysql与datetime_MySQL

mysql与datetime_MySQL

WBOY
Release: 2016-06-01 13:44:09
Original
1279 people have browsed it

bitsCN.com

 

最近遇到了这样的一个问题,从数据库中取出的数据明明是“2011-11-11”,但是程序在运行时总是显示得到的数据是“2011-11-10”。后来经过debug,发现JDBC connection以及resultset均是东8区(系统时区),而数据在存储时使用的是UTC时区,得到的时间总是提前了一天。在stackoverflow上找到了类似的问题http://stackoverflow.com/questions/1265688/mysql-date-problem-in-different-timezones。在setup connection时将时区设置为UTC后问题解决。

 

摘自 行风

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template