Home > Database > Mysql Tutorial > body text

整合php和mysql的时间 utc转为北京时间

WBOY
Release: 2016-06-07 16:26:41
Original
1236 people have browsed it

调整php和mysql的时间 utc转为北京时间 date_default_timezone_set(PRC) or die(时区设置失败,请联系管理员!); //设置php的时区,例如使用time函数mysql_query(SET time_zone = +8:00) or die(时区设置失败,请联系管理员!); //设置mysql的时区,例如使用n

调整php和mysql的时间 utc转为北京时间
date_default_timezone_set('PRC') or die('时区设置失败,请联系管理员!');   //设置php的时区,例如使用time函数
mysql_query("SET time_zone = '+8:00'") or die('时区设置失败,请联系管理员!');    //设置mysql的时区,例如使用now函数
Copy after login

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!