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

為什么Java的 java.time.format.DateTimeFormatter#format(Lo

Why does Java#39;s java.time.format.DateTimeFormatter#format(LocalDateTime) add a year?(為什么Java的 java.time.format.DateTimeFormatter#format(LocalDateTime) 加一年?)
本文介紹了為什么Java的 java.time.format.DateTimeFormatter#format(LocalDateTime) 加一年?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這是代碼:

LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(1451438792953L), ZoneId.of("UTC"));
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("YYYY-MM-dd'T'HH:mm:ss.SSS'Z'");
String output = dateTimeFormatter.format(localDateTime);

這是localDateTime的值:

2015-12-30T01:26:32.953

這是輸出的值:

2016-12-30T01:26:32.953Z

為什么要加一年?

java.time.temporal.WeekFields 中有幾個帶有 newYearWeek 的方法,這些方法有時將年份增加 1.為什么?

In java.time.temporal.WeekFields there are a couple of methods with a newYearWeek which increment the year by 1 on occasion. Why?

這是一個奇怪的錯誤.

推薦答案

來自 維基百科:

[YYYY] 表示 ISO 周編號年份,略不同于傳統的公歷年(見下文).

[YYYY] indicates the ISO week-numbering year which is slightly different from the traditional Gregorian calendar year (see below).

  1. YYYY 是年份的 ISO-8601 樣式表示.
  2. yyyy 是公歷年份表示.
  1. YYYY is an ISO-8601 style representation of the year.
  2. yyyy is the Gregorian year-of-era representation.

由于兩者的計算可以相差+1或-1,因此格式.更多有用信息請參見 YEAR_OF_ERA, YEARweekBasedYear.

Since the the calculation of the two can be different by +1 or -1, hence the formatting. More useful info at YEAR_OF_ERA, YEAR, and weekBasedYear.

這篇關于為什么Java的 java.time.format.DateTimeFormatter#format(LocalDateTime) 加一年?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Upload progress listener not fired (Google drive API)(上傳進度偵聽器未觸發(Google 驅動器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅動api服務賬戶查看上傳文件到谷歌驅動使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: 九九九久久国产免费 | 成人国产精品视频 | 毛片韩国 | 白浆在线| 日韩精品一区二区三区视频播放 | 日韩一区二区三区四区五区六区 | 国产成人精品免高潮在线观看 | www.av7788.com| 涩色视频在线观看 | 男人的天堂avav | 成人国产在线视频 | 国产在线精品区 | 欧美精品在线看 | 国产精品亚洲一区二区三区在线 | 精品免费视频 | 久久精品欧美一区二区三区不卡 | 999精品视频 | 中文字幕在线剧情 | 中文字幕在线观看www | 精品欧美色视频网站在线观看 | 国产不卡一区 | 久视频在线 | 亚洲a视频 | 久草综合在线视频 | 精品蜜桃一区二区三区 | 天天爽天天操 | 久久久99国产精品免费 | 精品伊人久久 | 国产精品高清在线 | 精品一区在线 | 久久久久久久久久久丰满 | 午夜影院在线观看 | 黄频视频 | 国产在线拍偷自揄拍视频 | 亚洲国产伊人 | 国产91久久久久蜜臀青青天草二 | 蜜臀av日日欢夜夜爽一区 | 欧美日韩不卡合集视频 | 国产成人免费视频网站视频社区 | 日本免费一区二区三区 | 久久久精品网站 |