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

Java 日歷設置不正確

Java Calendar Setting Incorrectly(Java 日歷設置不正確)
本文介紹了Java 日歷設置不正確的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我在使用 Java 的日歷時遇到了一些問題.我正在解析 txt 文件中的一些數據,并且需要創建一個日期.完成以下代碼后:

I'm having some trouble with Java's Calendar. I'm parsing some data from a txt file, and need to create a date. After completion of the following code:

tmpYear = Double.parseDouble(row[yearIndex]);
tmpMonth = Double.parseDouble(row[monthIndex]);
tmpDay = Double.parseDouble(row[dayIndex]);
if(timeIndex != -1)
    tmpTime = Double.parseDouble(row[timeIndex]);
if(secondsIndex != -1)
    tmpSeconds = Double.parseDouble(row[secondsIndex]);

我可以調試一下,看到變量如下:tmpYear == 2010
tmpMonth == 12
tmpDay == 30
tmpTime == 15(這是一天中的小時)
tmpSeconds == 0

I can debug and see that the variables are as follows: tmpYear == 2010
tmpMonth == 12
tmpDay == 30
tmpTime == 15 (This is the hour of the day)
tmpSeconds == 0

但是在運行以下代碼時:

But when running the following code:

cal.set((int)tmpYear,(int)tmpMonth,(int)tmpDay,(int)tmpTime,
            (int)((tmpTime - (int)tmpTime)*100),(int)tmpSeconds);
System.out.println(cal.getTime().toString());

我得到這個是為了輸出:
2011 年 1 月 30 日星期日 15:00:00 CST

I'm getting this for an output:
Sun Jan 30 15:00:00 CST 2011

有人能解釋一下這可能是什么原因嗎?提前感謝大家的幫助!

Can someone explain what a possible reason for this would be? Thank you all in advance for the help!

推薦答案

月份索引為 0-11 而不是 1-12.
0 = 一月
1 = 二月
...
11 = 十二月
請改用 tmpMonth = value -1.

months are indexed 0-11 instead of 1-12.
0 = January
1 = February
...
11 = December
Use tmpMonth = value -1 instead.

這篇關于Java 日歷設置不正確的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Parsing an ISO 8601 string local date-time as if in UTC(解析 ISO 8601 字符串本地日期時間,就像在 UTC 中一樣)
How to convert Gregorian string to Gregorian Calendar?(如何將公歷字符串轉換為公歷?)
Java: What/where are the maximum and minimum values of a GregorianCalendar?(Java:GregorianCalendar 的最大值和最小值是什么/在哪里?)
Calendar to Date conversion for dates before 15 Oct 1582. Gregorian to Julian calendar switch(1582 年 10 月 15 日之前日期的日歷到日期轉換.公歷到儒略歷切換)
java Calendar setFirstDayOfWeek not working(java日歷setFirstDayOfWeek不起作用)
Java: getting current Day of the Week value(Java:獲取當前星期幾的值)
主站蜘蛛池模板: 天堂综合网久久 | 精品成人| 少妇性l交大片免费一 | 一道本不卡视频 | 欧州一区二区 | 日本午夜一区二区三区 | 午夜婷婷激情 | 成人av播放 | 欧美日韩在线精品 | www.国产精 | 国产一二三视频在线观看 | 亚洲欧洲精品成人久久奇米网 | 在线观看亚洲一区二区 | 九九热免费观看 | 在线一区观看 | 国产精品视频一区二区三区不卡 | 久久久久久国产精品 | 国产中文字幕在线观看 | 精品日韩一区二区三区av动图 | 免费视频一区二区 | 国产乱精品一区二区三区 | 中国一级大毛片 | 另类视频在线 | 亚洲视频免费在线 | 国产精品亚洲第一区在线暖暖韩国 | 国产精品久久 | 亚洲美女在线视频 | 涩爱av一区二区三区 | 天天操一操 | 久久精品美女 | 久久亚洲综合 | 国产精品一区二区三区在线 | 欧洲色综合 | 国产农村妇女毛片精品久久麻豆 | 天堂色| 911网站大全在线观看 | 亚洲一区二区三区福利 | 黄色电影在线免费观看 | 国产日韩一区二区三区 | 久久久久久久91 | 欧美在线综合 |