java incorrect timezone(java时区不正确)
问题描述
我有一个 Java 实例,它似乎使用了一个完全不正确的时区.Windows 使用的不是澳大利亚/悉尼时区,而是美国/加拉加斯时区.
I have an instance of Java which seems to be using a completely incorrect time zone. Instead of using the Australia/Sydney time zone which Windows is using, it is using the America/Caracas time zone.
我先通过系统时钟查看Windows时间,然后查看HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/和ControlSet001、ControlSet002.全部设置为悉尼时区.
I checked the Windows time through the system clock firstly, then checked HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/ and ControlSet001, ControlSet002. All are set to a Sydney time zone.
有人知道这是否是 Java 中的错误,还是指的是其他地方设置的时间?
Does anybody know if this is a bug in Java, or if it is referring to a time set elsewhere?
Java 版本为 1.6.0_06
Java version is 1.6.0_06
推荐答案
确保在启动应用程序时为 JVM 设置了时区:
Ensure you set the timezone for the JVM when starting the application:
-Duser.timezone="Australia/Sydney"
这篇关于java时区不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:java时区不正确
基础教程推荐
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
