Java LocalDate類| getChronology()方法與示例

LocalDate類getChronology()方法 (LocalDate Class getChronology() method)

  • getChronology() method is available in java.time package.

    getChronology()方法在java.time包中可用。

  • getChronology() method is used to return the IsoChronology of this LocalDate object.

    getChronology()方法用于返回此LocalDate對象的IsoChronology。

  • getChronology() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    getChronology()方法是一個非靜態方法,只能通過類對象進行訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • getChronology() method does not throw an exception at the time of getting chronology.

    getChronology()方法在獲取時間順序時不會引發異常。

Syntax:

句法:

    public IsoChronology getChronology();

Parameter(s):

參數:

  • None

    沒有

Return value:

返回值:

The return type of this method is IsoChronology, it returns the chronology based on ISO of this LocalDate.

此方法的返回類型為IsoChronology ,它基于此LocalDate的ISO返回年代。

Example:

例:

// Java program to demonstrate the example 
// of getChronology() method 
// of LocalDate
import java.time.*;
import java.time.chrono.*;
public class GetChronologyOfLocalDate {
public static void main(String args[]) {
// Instantiates two LocalDate
LocalDate l_da1 = LocalDate.parse("2007-04-04");
LocalDate l_da2 = LocalDate.now();
// Display l_da1,l_da2
System.out.println("LocalDate l_da1 and l_da2: ");
System.out.println("l_da1: " + l_da1);
System.out.println("l_da2: " + l_da2);
System.out.println();
// Here, this method gets the chronology
// of this date l_da1 that is based 
// on ISO
IsoChronology chronology = l_da1.getChronology();
// Display chronology
System.out.println("l_da1.getChronology(): " + chronology);
// Here, this method gets the chronology
// of this date l_da2 that is also
// based on ISO
chronology = l_da2.getChronology();
// Display chronology
System.out.println("l_da2.getChronology(): " + chronology);
}
}

Output

輸出量

LocalDate l_da1 and l_da2: 
l_da1: 2007-04-04
l_da2: 2020-05-29l_da1.getChronology(): ISO
l_da2.getChronology(): ISO

翻譯自: https://www.includehelp.com/java/localdate-getchronology-method-with-example.aspx

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/542107.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/542107.shtml
英文地址,請注明出處:http://en.pswp.cn/news/542107.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python—字典

1.字典的含義: 字典和列表類似,是可變序列,與列表不同的是,字典是無序的可變序列,保存的內容是以 鍵值對 的形式存放的。鍵是唯一的,而值可以是多個。值可以取任意數據了類型,但鍵必須是不可變…

js中加“var”和不加“var”的區別,看完覺得這么多年js白學了

Javascript聲明變量的時候,雖然用var關鍵字聲明和不用關鍵字聲明,很多時候運行并沒有問題,但是這兩種方式還是有區別的。可以正常運行的代碼并不代表是合適的代碼。var num 1; 是在當前域中聲明變量. 如果在方法中聲明&#xff0…

解決方案_智能工廠全套解決方案

最近弱電社群資料更新情況:1、弱電學習圈VIP群資料整理-希望對您有用!2、弱電學習圈VIP技術交流2群成立,歡迎您加入!3、智慧校園整體解決方案!4、智能化弱電項目管理表單大全-弱電項目經理必備!5、弱電項目…

退火算法 貪婪算法_算法貪婪策略簡介

退火算法 貪婪算法介紹 (Introduction) The solution is determined by a sequence of steps each step has given a particular solution and later a complete solution to given the problem can be achieved. In short, while making a choice there should be a greed for…

windows 2008 R2系統安裝撥號v p n詳細配置

windows 2008 R2系統單網卡安裝撥號v p n系統環境:windows 2008 R2操作步驟首先設置服務端在服務器管理器中添加角色“網絡策略和訪問服務”,并安裝以下角色服務右擊路由與遠程訪問,選擇“配置并啟用路由和遠程訪問”右擊路由與遠程訪問&…

python—函數

1. 函數的定義: 1 . 含義:我們把實現某一功能的代碼定義為一個函數,在需要使用時,隨時調用,十分方便。對于函數,簡單理解就是可以完成某功能的代碼塊,可反復使用。 Python提供了許多內建函數&a…

word打開老是配置進度_小白教程 | office出現配置進度框,怎么辦?

最近很多同學在備考二級時候,自己的電腦上office軟件Word或者Excel出問題了,每次打開都會出現配置進度框。這種情況怎么辦呢?這種情況都是注冊表的問題,馬上安排解決之前在 右鍵菜單沒有office新建怎么辦(點擊即可閱讀)也是用注冊…

【踩坑速記】開源日歷控件,順便全面解析開源庫打包發布到Bintray/Jcenter全過程(新),讓開源更簡單~...

一、寫在前面 自使用android studio開始,就被它獨特的依賴方式:compile com.android.support:appcompat-v7:25.0.1所深深吸引,自從有了它,麻麻再也不用擔心依賴第三方jar包繁瑣無趣啦。而,如果自己寫一個開源庫是一種怎…

scala集合中添加元素_如何在Scala中獲得列表的第一個元素?

scala集合中添加元素清單 (List) A list is a linear data structure. It is a collection of elements of the same data types. 列表是線性數據結構。 它是相同數據類型的元素的集合。 Scala libraries have many functions to support the functioning of lists. Methods l…

python—列表、字典生成式

1 列表生成式 Python內置的一種極其強大的生成列表 list 的表達式。返回結果必須是列表。 示例: 需求1:接收變量 k a b s 51 5000 10000 a s.split() li [] for item in s.split():li.append(int(item)) k,a,b li print(k,a,b)運行結果:…

excel數據平均分配給多人_excel表格 怎樣均分數據-用Excel怎么才能將組數據平均分配給幾個人...

怎樣在Excel表格中求平均數?在excel中怎樣自動生成各班各科的平均成績可以調用Excel函數庫的函實現。步驟如下:1. 在單元格內點擊上公式-平均值”。2. 點擊需要參與計算的單元格數據,符號用鍵盤輸入,最后回車即可。百度百科-Excel函數exce…

Java中List和Map接口之間的區別

列表與地圖界面 (List vs Map interface) Here, we will see how List differs from Map interface in Java and we will see the points given below, 在這里,我們將看到List與Java中的Map接口有何不同,并且我們將看到以下幾點, 列表界面 (…

python—高階函數

什么是內置高階函數: 一個函數可以作為參數傳給另外一個函數,或者一個函數的返回值為另外一個函數(若返回值為該函數本身,則為遞歸),滿足其一則為高階函數。 Python中內置了幾個常用的高階函數,…

功能區不顯示工具條_【新老客戶必知】軟件支持超高清屏顯示器了

隨著計算機硬件的不斷更新換代顯示設備的不斷更新從原來的分辨率640 X 480啥原來分辨這么低呀?還記得DOS嗎?或者Win95,win98嗎當時顯示器分辨率能調到800X 600很好了2000年左右隨著純平顯示器的推出也有了高清顯示器的概念那么一般我們說的高清顯示器分辨…

nginx1.10.2源碼安裝配置參數參考

[rootlocalhost nginx-1.10.2]# ./configure --help--help print this message--prefixPATH set installation prefix #Nginx安裝的根路徑,默認為 /usr/local/nginx。--sbin-pathPATH set nginx binary pathname #指定nginx二進制文件的路徑,默認為PATH/sbin/n…

c ++查找字符串_C ++朋友功能| 查找輸出程序| 套裝1

c 查找字符串Program 1: 程序1&#xff1a; #include <iostream>using namespace std;class Sample {int A, B;friend void fun();};void fun(){Sample S;S.A 10;S.B 20;cout << S.A << " " << S.B << endl;}int main(){fun();retu…

Spring定時器的運用

為什么80%的碼農都做不了架構師&#xff1f;>>> 一、spring4定時器任務配置如下&#xff1a; <bean id"jsapiTask" class"chan.ye.dai.wexin.JsapiTicketTimeTask" /><bean id"jobDetail"class"org.springframework.s…

python—裝飾器

裝飾器概念&#xff1a; 把一個函數當作參數傳遞給一個函數&#xff0c;返回一個替代版的函數 本質上就是一個返回函數的函數 在不改變原函數的基礎上&#xff0c;給函數增加功能 python 中裝飾器做的事情&#xff01;它們封裝一個函數&#xff0c;并且用這樣或者那樣的方式來修…

ad18原理圖器件批量修改_Altium Designer 15原理圖設計基礎

Altium Designer 15成為越來越多電子設計開發工程師EDA電路設計軟件的首選&#xff0c;在學校學習Altium Designer的也越來較多&#xff0c;像單片機開發學習一樣&#xff0c;EDA設計只要學會了&#xff0c;再學其他的設計軟件就容易多了。上一節分享了《Altium Designer 15集成…

c++freopen函數_使用示例的C語言中的freopen()函數

cfreopen函數C語言中的freopen()函數 (freopen() function in C) Prototype: 原型&#xff1a; FILE* freopen(const char *str, const char *mode, FILE *stream);Parameters: 參數&#xff1a; const char *str, const char *mode, FILE *streamReturn type: FILE* 返回類型…