問題描述
Oracle 文檔 http://docs.oracle.com/javase/6/docs/technotes/guides/intl/calendar.doc.html 聲明 Java 支持 3 種日歷系統(tǒng):公歷、日本帝國和泰國佛教.Java 是否支持儒略歷?
Oracle docs http://docs.oracle.com/javase/6/docs/technotes/guides/intl/calendar.doc.html states that Java supports 3 calendar systems: Gregorian, Japanese Imperial and Thai Buddhist. Does Java support Julian calendar?
推薦答案
是的.
來自 GregorianCalendar 的文檔:
From the doc of GregorianCalendar:
GregorianCalendar 是一種混合日歷,同時支持儒略歷和公歷系統(tǒng),支持單一不連續(xù)性,默認情況下對應(yīng)于公歷日期公歷開始制定(1582 年 10 月 15 日)國家,后來在其他國家).截止日期可能會由調(diào)用者通過調(diào)用 setGregorianChange().
GregorianCalendar is a hybrid calendar that supports both the Julian and Gregorian calendar systems with the support of a single discontinuity, which corresponds by default to the Gregorian date when the Gregorian calendar was instituted (October 15, 1582 in some countries, later in others). The cutover date may be changed by the caller by calling setGregorianChange().
使用 setGregorianChange
來改變它.
public void setGregorianChange(Date date) 設(shè)置 GregorianCalendar改變?nèi)掌?這是從 Julian 轉(zhuǎn)換到發(fā)生公歷日期.默認值為 1582 年 10 月 15 日(公歷).在此之前,日期將采用儒略歷.獲得一個純?nèi)迓詺v,將更改日期設(shè)置為 Date(Long.MAX_VALUE).到獲取純公歷,將更改日期設(shè)置為日期(Long.MIN_VALUE).
public void setGregorianChange(Date date) Sets the GregorianCalendar change date. This is the point when the switch from Julian dates to Gregorian dates occurred. Default is October 15, 1582 (Gregorian). Previous to this, dates will be in the Julian calendar. To obtain a pure Julian calendar, set the change date to Date(Long.MAX_VALUE). To obtain a pure Gregorian calendar, set the change date to Date(Long.MIN_VALUE).
這篇關(guān)于Java 支持儒略歷嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!