久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

時(shí)區(qū)、日歷和 SimpleDateFormat 的奇怪問題

Strange problem with timezone, calendar and SimpleDateFormat(時(shí)區(qū)、日歷和 SimpleDateFormat 的奇怪問題)
本文介紹了時(shí)區(qū)、日歷和 SimpleDateFormat 的奇怪問題的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

讓我們考慮以下代碼:

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy", Locale.US);
long start = sdf.parse("10:30:00 30/09/2009").getTime();
long end = sdf.parse("10:30:00 30/10/2009").getTime();

Calendar c = Calendar.getInstance(Locale.US);
c.setTimeInMillis(start);
System.out.println("Start = " + c.getTime());
c.setTimeInMillis(end);
System.out.println("  End = " + c.getTime());

運(yùn)行此代碼段時(shí),我有以下輸出:

When running this code snippet, I have the following output:

Start = Wed Sep 30 10:30:00 CEST 2009
  End = Fri Oct 30 10:30:00 CET 2009

為什么我得到不同的時(shí)區(qū)?

Why do I get different timezone ?

請(qǐng)注意,如果我將第一個(gè)日期設(shè)置為 8 月,第二個(gè)日期設(shè)置為 9 月,則兩種情況下的輸出將顯示相同的時(shí)區(qū):

Note that if I set the first date in august and the second one in september, the output will display the same timezone in both cases:

long start = sdf.parse("10:30:00 30/08/2009").getTime();
long end = sdf.parse("10:30:00 30/09/2009").getTime();

將顯示:

Start = Sun Aug 30 10:30:00 CEST 2009
  End = Wed Sep 30 10:30:00 CEST 2009

我使用的是 Java 1.6.0_14

I'm using Java 1.6.0_14

推薦答案

CEST 是中歐夏令時(shí).與夏令時(shí)生效的 CET 相同.

CEST is Central European Summer Time. It is the same as CET with daylight savings into effect.

這篇關(guān)于時(shí)區(qū)、日歷和 SimpleDateFormat 的奇怪問題的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時(shí)間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉(zhuǎn)換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉(zhuǎn)換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當(dāng)前星期幾的值)
主站蜘蛛池模板: 黄色日皮视频 | 日本少妇一区二区 | 亚洲欧美另类在线 | 天天射天天舔 | 日韩一二区 | 黄色av免费| 久久99深爱久久99精品 | a级片网址| 一本久久道 | 日本免费一级片 | 中文字幕在线观看一区二区三区 | 国产成人免费在线视频 | 国产永久在线 | 久久99视频| 精品第一页 | 日本a在线观看 | 午夜精品国产精品大乳美女 | 日韩午夜av | 青青草免费在线视频 | 成人三级在线观看 | 一本久久道 | 成人国产综合 | 成人一区在线观看 | 午夜天堂在线 | 青青久草 | 欧美一区二区三区四区五区 | 双性呜呜宫交受不住了h | 国内福利视频 | 性色av一区二区 | 日韩欧美在线观看视频 | 日韩欧美高清 | 免费成人深夜夜行网站 | 欧美日韩一区二区在线观看 | 久久免费看视频 | 日本韩国欧美中文字幕 | 成人午夜网站 | 日日夜夜狠狠干 | 五月婷婷在线播放 | 一级黄色免费视频 | 亚洲综合自拍 | 国产自在线 |