java時間格式的簡單整理
概述
自己在使用Java日志格式的時候,發(fā)現(xiàn)不好定義。所以本篇文章的主要目的是收集一些常用的日志格式,解說每個字段代表的意思以及擴充部分Java常用的時間類。
名詞解釋
時刻:時刻是時間上的某個瞬間,,或是時間軸上的某個點。時刻可以作為時間間隔的起點和終點
時代:一個時代是用作測量其他時刻的起源的瞬間。 時代是在1970-01-01T00:00:00Z。時代之后的時刻具有正值,而時代之前的時刻具有負(fù)值。
java 8類說明
java.time 包含的api都是基于iso 8601的。
1.java.time.LocalDate:LocalDate是一個不可變的類,它表示默認(rèn)格式(yyyy-MM-dd)的日期
2.java.time.LocalTime:LocalTime是一個不可變的類,它的實例代表一個符合人類可讀格式的時間,默認(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.


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

