优化一个网站多少钱,招远市建设局网站,什么是网络营销?与电商营销有什么区别?,网站开发 项目计划书服务器部署海外#xff0c;这时候#xff0c;需要考虑时区问题#xff0c;很多程序地方不能写死#xff0c;需要调整中间件或者服务器时区#xff0c;代码使用localTime。 1、服务器 Linux CentOS7
# 设置时区
timedatectl set-timezone Europe/London# 列出伦敦 时区设置…服务器部署海外这时候需要考虑时区问题很多程序地方不能写死需要调整中间件或者服务器时区代码使用localTime。 1、服务器 Linux CentOS7
# 设置时区
timedatectl set-timezone Europe/London# 列出伦敦 时区设置
timedatectl list-timezones | grep London
Europe/London# 使用timedatectl命令也可以看到时区已经修改
timedatectlLocal time: Wed 2024-04-03 04:20:34 BSTUniversal time: Wed 2024-04-03 03:20:34 UTCRTC time: Wed 2024-04-03 03:20:33Time zone: Europe/London (BST, 0100)NTP enabled: yes
NTP synchronized: yesRTC in local TZ: noDST active: yesLast DST change: DST began atSun 2024-03-31 00:59:59 GMTSun 2024-03-31 02:00:00 BSTNext DST change: DST ends (the clock jumps one hour backwards) atSun 2024-10-27 01:59:59 BSTSun 2024-10-27 01:00:00 GMT2、数据库
调整数据库默认使用 SYSTEM
客户端连接增加参数: GMT%2B1 -- GMT1
mysql://127.0.0.1:3306/user_demo?useUnicodetruecharacterEncodingutf8zeroDateTimeBehaviorconvertToNulluseSSLtrueserverTimezoneGMT%2B1
3、代码中可以参考时间字段的序列化和反序列化处理
LocalDateTime序列化_localdatetime序列化补了-CSDN博客