久久久久久久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:獲取當前星期幾的值)
主站蜘蛛池模板: 成人国产精品色哟哟 | 国产高清性xxxxxxxx | 亚洲国产精品一区二区三区 | 久久精品69| 欧美激情一区二区三区 | 国产精品欧美一区二区三区不卡 | 亚洲成年在线 | 古装人性做爰av网站 | 国产激情一区二区三区 | 日韩网站在线 | 久久高清精品 | 久久精品国产亚洲一区二区三区 | 久久精品亚洲精品国产欧美 | 一区二区三区四区不卡视频 | 老司机狠狠爱 | 99久久99| 国产aⅴ爽av久久久久久久 | 我我色综合| www.精品一区 | 第四色播日韩第一页 | 精品视频一区二区三区在线观看 | 羞羞视频在线观免费观看 | 一区二区三区小视频 | 日本在线视频一区二区 | 特级黄一级播放 | 免费一级片 | 日韩一区二区三区在线视频 | 国产成人一区在线 | 日韩精品久久 | 国产精品久久久久免费 | 中文字幕亚洲欧美日韩在线不卡 | 男人的天堂在线视频 | 日韩www| 亚洲色欧美另类 | 依人成人 | 成人免费视频网站在线看 | 97视频免费 | 有码一区| 国产在线视频一区二区董小宛性色 | 国产精品毛片av | 91精品久久久久久久久中文字幕 |