四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

How do I change MySQL timezone?



However, there are ways for you to get results that are in your preferred timezone. First determine how many hours your desired timezone is off from MST. For example, EST is +2 hours. PST is -1 hour.

Knowing the time offset, you can replace all your SQL statements of 


SELECT NOW();

with


SELECT DATE_ADD(NOW(), INTERVAL 2 HOUR);

which will give you an EST date result. For a result in PST, you would do:


SELECT DATE_SUB(NOW(), INTERVAL 1 HOUR);

If you are working with time in seconds instead of dates, then factor in the offset in seconds. Because there are 3600 seconds in an hour, and EST is 2 hours later than MST, the following converts timestamps from MST to EST:


SELECT unix_timestamp() + (3600 * 2);

SELECT FROM_UNIXTIME(UNIX_TIMESTAMP() + (3600 * 2));

See the MySQL Manual's Date and Time Functions for more information.

Depending on your application, you may also need to do one of the following (but not both):

1. Find every place in your code where a date or time is displayed to the browser and have a user defined function change it to add or subtract the appropriate number of hours before displaying it.

2. Find every place in your code where dates or times are input into your system and have a user defined function add or subtract the appropriate number of hours before storing it.

php技術(shù)How do I change MySQL timezone?,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 秀人网朱可儿| 英雄卡片简单又漂亮| b超怎么看是男孩女孩| 男人伤感失落孤独头像| 一路狂奔| 买买提个人资料简历| 十面埋伏 电影| 不要好舒服| 哥谭小丑杰罗姆电影| 董三毛| 基尼斯和吉尼斯有什么区别| 饥渴的爱| 芭蕉扇图片| 夜生活女王之霞姐| 陕西卫视节目表| 梁祝吉他谱独奏完整| 黑暗森林 电影| 野孩子美剧| 《红色》电影| oldpussy| 莫比乌斯电影在线观看全集高清| 拔萝卜歌谱| 熊欣欣个人资料| 驯服型男刑警队长| 民国往事电视剧演员表| 6夜间飞行的秘密| 四大美人之貂蝉香港剧| 完美的邻居| 1988年英国的白蛇传说| 绝不放弃电影| 松雪泰子| 洛兵| 理发店3| 黄网站在线免费看| ryan reynolds| 凤凰卫视节目表| angelababy婚礼大作战| 约翰尼·西蒙斯| cctv16直播| 密桃成孰时| 绝对权力在线观看免费|