java時(shí)間格式的簡(jiǎn)單整理
概述
自己在使用Java日志格式的時(shí)候,發(fā)現(xiàn)不好定義。所以本篇文章的主要目的是收集一些常用的日志格式,解說每個(gè)字段代表的意思以及擴(kuò)充部分Java常用的時(shí)間類。
名詞解釋
時(shí)刻:時(shí)刻是時(shí)間上的某個(gè)瞬間,,或是時(shí)間軸上的某個(gè)點(diǎn)。時(shí)刻可以作為時(shí)間間隔的起點(diǎn)和終點(diǎn)
時(shí)代:一個(gè)時(shí)代是用作測(cè)量其他時(shí)刻的起源的瞬間。 時(shí)代是在1970-01-01T00:00:00Z。時(shí)代之后的時(shí)刻具有正值,而時(shí)代之前的時(shí)刻具有負(fù)值。
java 8類說明
java.time 包含的api都是基于iso 8601的。
1.java.time.LocalDate:LocalDate是一個(gè)不可變的類,它表示默認(rèn)格式(yyyy-MM-dd)的日期
2.java.time.LocalTime:LocalTime是一個(gè)不可變的類,它的實(shí)例代表一個(gè)符合人類可讀格式的時(shí)間,默認(rèn)格式是hh:mm:ss.zzz
ISO字符替代說明
[Y] represents a digit used in the time element “year”;
[M] represents a digit used in the time element “month”;
[D] represents a digit used in the time element “day”;
[w] represents a digit used in the time element “week”;
[h] represents a digit used in the time element “hour”;
[m] represents a digit used in the time element “minute”;
[s] represents a digit used in the time element “second”;
[n] represents a digit from a positive integer or zero;
[±] represents a plus sign [+] if in combination with the following element a positive value or zero needs to be represented (in this case, unless explicitly stated otherwise, the plus sign shall not be omitted), or a minus sign [−] if in combination with the following element a negative value needs to be represented.
In addition the following convention applies:
[_] When any of the characters representing a digit is underlined, it represents zero or more digits
in the corresponding date and time representation.
Other characters in the date and time format representations are copied in the date and time
representations.


時(shí)間格式收錄
| 序號(hào) | 格式 | 示例 |
|---|---|---|
| 1 | yyyy/MM/dd HH:mm:ss Z | 2018/05/16 15:09:02 +0800 |
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- Java前后端時(shí)間格式的轉(zhuǎn)化方式
- Java SimpleDateFormat中英文時(shí)間格式化轉(zhuǎn)換詳解
- 新手小白學(xué)JAVA 日期類Date SimpleDateFormat Calendar(入門)
- java的SimpleDateFormat線程不安全的幾種解決方案
- 解決Java中SimpleDateFormat線程不安全的五種方案
- Java在并發(fā)環(huán)境中SimpleDateFormat多種解決方案
- Java SimpleDateFormat線程安全問題原理詳解
- JAVA使用SimpleDateFormat類表示時(shí)間代碼實(shí)例
- Java 時(shí)間格式轉(zhuǎn)換之impleDateFormat與Data API解析與使用
相關(guān)文章
springboot 無法掃描到父類模塊中Bean的原因及解決
這篇文章主要介紹了springboot 無法掃描到父類模塊中Bean的原因及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-08-08
關(guān)于SpringBoot的自動(dòng)裝配原理詳解
這篇文章主要介紹了關(guān)于SpringBoot的自動(dòng)裝配原理詳解,Spring?Boot自動(dòng)裝配原理是指Spring?Boot在啟動(dòng)時(shí)自動(dòng)掃描項(xiàng)目中的依賴關(guān)系,根據(jù)依賴關(guān)系自動(dòng)配置相應(yīng)的Bean,從而簡(jiǎn)化了Spring應(yīng)用的配置過程,需要的朋友可以參考下2023-07-07
SpringBoot應(yīng)用部署到外置Tomcat的實(shí)現(xiàn)
SpringBoot內(nèi)置tomcat使用很方便,本文主要介紹了SpringBoot應(yīng)用部署到外置Tomcat的實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下2024-07-07
Java如何獲取Json中的數(shù)據(jù)實(shí)例代碼
這篇文章主要給大家介紹了關(guān)于Java如何獲取Json中數(shù)據(jù)的相關(guān)資料,我們?cè)谌粘i_發(fā)中少不了和JSON數(shù)據(jù)打交道,那么我們來看看JAVA中常用的JSON獲取方式,需要的朋友可以參考下2023-09-09
springboot自動(dòng)掃描添加的BeanDefinition源碼實(shí)例詳解
這篇文章主要給大家介紹了關(guān)于springboot自動(dòng)掃描添加的BeanDefinition的相關(guān)資料,文中通過實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2022-02-02
SpringCloud-Gateway轉(zhuǎn)發(fā)WebSocket失敗問題及解決
這篇文章主要介紹了SpringCloud-Gateway轉(zhuǎn)發(fā)WebSocket失敗問題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-09-09
jxl操作excel寫入數(shù)據(jù)不覆蓋原有數(shù)據(jù)示例
網(wǎng)上很多例子,都是用Jxl讀或者寫excel,本文實(shí)現(xiàn)的功能就是將數(shù)據(jù)源in.xls的第幾行第幾列數(shù)據(jù)寫入到out.xls的第幾行第幾列,不覆蓋out.xls其他原有的數(shù)據(jù)。2014-03-03
java 交換兩個(gè)數(shù)據(jù)的方法實(shí)例詳解
這篇文章主要介紹了java 交換兩個(gè)數(shù)據(jù)的方法實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下2016-12-12
AQS(AbstractQueuedSynchronizer)抽象隊(duì)列同步器及工作原理解析
AQS是用來構(gòu)建鎖或者其他同步器組件的重量級(jí)基礎(chǔ)框架及整個(gè)JUC體系的基石,通過內(nèi)置的FIFO對(duì)列來完成資源獲取線程的排隊(duì)工作,并通過一個(gè)int類型變量表示持有鎖的狀態(tài),本文給大家詳細(xì)介紹下AQS抽象隊(duì)列同步器的相關(guān)知識(shí),感興趣的朋友一起看看吧2022-03-03

