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

在 Java 中將 EST 轉換為 EDT 或反之亦然

Converting EST to EDT or vice versa in Java(在 Java 中將 EST 轉換為 EDT 或反之亦然)
本文介紹了在 Java 中將 EST 轉換為 EDT 或反之亦然的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

誰能說說三件事:

  1. 如何從 java.util.Date 實例中獲取 TimeZone?
  2. 如何知道夏令時是否適用?
    我想我可以通過 timeZone.getDSTSavings 知道,但我面臨的問題是,即使我將系統的日期設為 2012 年 2 月 1 日,我仍然是將值設為正數(我猜是 3600000)
  3. 如何將 EST 時間轉換為 EDT,反之亦然?

推薦答案

如何從 java.util.Date 實例中檢索 TimeZone?

How to retrieve TimeZone from java.util.Date instance?

沒有這樣的事情.Date just 表示自 Unix 紀元(UTC 時間 1970 年 1 月 1 日午夜)以來的毫秒數.它與特定的日歷系統或時區無關.換句話說,如果我和一個朋友一起打電話(零延遲;)并且我點擊我的手指,我們都會同意該點擊的 Date -即使我使用公歷而他使用儒略歷,即使我在倫敦而他在紐約.這是相同的即時.

There's no such thing. A Date just represents a number of milliseconds since the Unix epoch, which was midnight on January 1st 1970 UTC. It's not associated with a particular calendar system or time zone. To put it another way, if a friend and I are on the phone together (with a zero latency ;) and I click my fingers, we would both agree on the Date at which that click too place - even if I'm using the Gregorian calendar and he's using the Julian calendar, and even if I'm in London and he's in New York. It's the same instant in time.

如何知道夏令時是否適用?,我想我可以通過 timeZone.getDSTSavings 知道,但我面臨的問題是,即使我將系統的日期設為 2012 年 2 月 1 日,我仍然可以獲得價值為正(我猜是 3600000)

How to know whether Daylight savings is applicable?, I suppose I can know it by doing timeZone.getDSTSavings, but problem I am facing is that even if I make my system's date as Feb 1 2012, still I am getting the value as positive (I guess 3600000)

理想情況下,使用 Joda Time 而不是 java.util.Date/Calendar/TimeZone,但在 TimeZone 內您可以使用 TimeZone.getOffset(long) 查找與 UTC 的偏移量,或 TimeZone.inDaylightTime(Date) 只給你一個是/否的答案.

Ideally, use Joda Time instead of java.util.Date/Calendar/TimeZone, but within TimeZone you can use TimeZone.getOffset(long) to find the offset from UTC, or TimeZone.inDaylightTime(Date) to just give you a yes/no answer.

如何將 EST 時間轉換為 EDT,反之亦然?

How to convert EST time to EDT or vice versa?

通常這是一個無效的問題 - 因為在任何一個時間實例中, EST EDT 適用.您通常會從一個時區轉換到另一個時區,并且EDT"和EST"不是不同的時區——它們是相同時區內的不同偏移量.您要求這樣做的事實表明您可能一開始就錯誤地對數據進行了建模(不幸的是,這對于日期/時間值很容易做到).請向我們提供更多信息,我們或許可以為您提供更多幫助.

Usually that's an invalid question - because at any one instance in time, either EST or EDT applies. You normally convert from one time zone to another, and "EDT" and "EST" aren't different time zones - they're different offsets within the same time zone. The fact that you're asking for this suggests that you may be modelling your data incorrectly to start with (which is unfortunately easy to do with date/time values). Please give us more information and we may be able to help you more.

這篇關于在 Java 中將 EST 轉換為 EDT 或反之亦然的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
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 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 欧美日韩视频在线播放 | 可以免费观看的av片 | 午夜影院官网 | 中文字幕一区二区三区精彩视频 | 国产日韩一区二区三免费 | 亚洲精品久久久一区二区三区 | 亚洲精品日韩在线 | 国产 日韩 欧美 在线 | 成人免费视频网站在线看 | 国产四虎 | www.天天操.com | 国产91视频免费 | 国产在线精品一区二区 | 男女深夜网站 | 亚洲视频在线免费 | 亚洲高清三级 | 欧美一区二区三区在线观看视频 | 久久精品无码一区二区三区 | 国产农村妇女毛片精品久久麻豆 | 99免费视频 | 久久专区| 欧美在线视频一区二区 | 日韩午夜在线观看 | 91中文在线观看 | 男女羞羞视频在线 | 国产精品美女www爽爽爽 | 日韩三级在线观看 | 中文字幕国产高清 | m豆传媒在线链接观看 | 成人性生交大片免费看中文带字幕 | 免费成年网站 | 亚洲天堂一区二区 | 欧美性tv| 国产乱xxav| 二区三区视频 | 久久国产精品久久久久久久久久 | 国产欧美日韩 | 在线伊人 | 欧美涩涩网 | 久久黄色| 精品欧美|