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

在 Java 中將 EST 轉(zhuǎn)換為 EDT 或反之亦然

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

問題描述

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

誰能說說三件事:

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

推薦答案

如何從 java.util.Date 實(shí)例中檢索 TimeZone?

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

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

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.

如何知道夏令時(shí)是否適用?,我想我可以通過 timeZone.getDSTSavings 知道,但我面臨的問題是,即使我將系統(tǒng)的日期設(shè)為 2012 年 2 月 1 日,我仍然可以獲得價(jià)值為正(我猜是 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 內(nèi)您可以使用 TimeZone.getOffset(long) 查找與 UTC 的偏移量,或 TimeZone.inDaylightTime(Date) 只給你一個(gè)是/否的答案.

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 時(shí)間轉(zhuǎn)換為 EDT,反之亦然?

How to convert EST time to EDT or vice versa?

通常這是一個(gè)無效的問題 - 因?yàn)樵谌魏我粋€(gè)時(shí)間實(shí)例中, EST EDT 適用.您通常會(huì)從一個(gè)時(shí)區(qū)轉(zhuǎn)換到另一個(gè)時(shí)區(qū),并且EDT"和EST"不是不同的時(shí)區(qū)——它們是相同時(shí)區(qū)內(nèi)的不同偏移量.您要求這樣做的事實(shí)表明您可能一開始就錯(cuò)誤地對(duì)數(shù)據(jù)進(jìn)行了建模(不幸的是,這對(duì)于日期/時(shí)間值很容易做到).請(qǐng)向我們提供更多信息,我們或許可以為您提供更多幫助.

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.

這篇關(guān)于在 Java 中將 EST 轉(zhuǎn)換為 EDT 或反之亦然的文章就介紹到這了,希望我們推薦的答案對(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综合| 狠狠做六月爱婷婷综合aⅴ 国产精品视频网 | 国产男女视频网站 | 91中文字幕在线 | 9999国产精品欧美久久久久久 | 五月天婷婷综合 | 国产片侵犯亲女视频播放 | 欧美激情一区 | 国产小视频在线观看 | 午夜爱爱毛片xxxx视频免费看 | 国产 日韩 欧美 中文 在线播放 | www.国产精品 | 久久精品av | 国产精品久久 | 成人国产精品久久 | 精品国产一区久久 | 亚洲国产精品久久 | 中文字幕一区二区三区四区五区 | 久久久久久久夜 | 国产精品久久午夜夜伦鲁鲁 | eeuss国产一区二区三区四区 | 香蕉久久av | 正在播放国产精品 | 欧美黑人一级爽快片淫片高清 | www.中文字幕.com | 国产福利小视频 | a网站在线观看 | 色接久久 | 一区二区在线免费观看 | 午夜视频免费在线 | 第一区在线观看免费国语入口 |