惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - 笨笨

UTF-8 Oracle生成MD5 How do you define Success? pbrun su -root Shell/Windows命令备忘 爸妈 Spring中的exception处理 What is ieHTTPHeaders? SLA(Service Level Agreement) Cluster/Fail-Over/Load Banlance Thread Dump 非常郁闷 Bea World 2005 materials available now 程序依赖库的管理 EJB琐碎的想法 J2EE的世界越来越精彩了 LDAP信息模型 人类进入文明史的标志 Socket
TimeZone
笨笨 · 2005-12-23 · via 博客园 - 笨笨

1     TimeZone gmt = TimeZone.getTimeZone("GMT");
2 
3     Calendar epoch1900 = Calendar.getInstance(gmt);

可以解决我们的环境中各个服务器之间的时区不同步的问题。

 1     /**
 2      * Gets the <code>TimeZone</code> for the given ID.
 3      *
 4      * @param ID the ID for a <code>TimeZone</code>, either an abbreviation
 5      * such as "PST", a full name such as "America/Los_Angeles", or a custom
 6      * ID such as "GMT-8:00". Note that the support of abbreviations is
 7      * for JDK 1.1.x compatibility only and full names should be used.
 8      *
 9      * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID
10      * cannot be understood.
11      */
12     public static synchronized TimeZone getTimeZone(String ID) {
13     return getTimeZone(ID, true);
14     }
15 
16     private static TimeZone getTimeZone(String ID, boolean fallback) {
17     TimeZone tz = ZoneInfo.getTimeZone(ID);
18     if (tz == null) {
19         tz = parseCustomTimeZone(ID);
20         if (tz == null && fallback) {
21         tz = new ZoneInfo(GMT_ID, 0);
22         }
23     }
24     return tz;
25     }