日历错误的一周 [英] Calendar giving wrong day of week
本文介绍了日历错误的一周的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个日历对象如下所示 2014年8月8日
。这是星期五。所以 myCal.get(Calendar.DAY_OF_WEEK)
应为6.但它给出2.为什么?
I have a calendar object as below that represents 08 Aug 2014
.It is a Friday. So myCal.get(Calendar.DAY_OF_WEEK)
should be 6. But it gives 2. Why is that?
java.util.GregorianCalendar[time=1410177767000,areFieldsSet=true,lenient=true,zone=Asia/Calcutta,firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2014,MONTH=8,WEEK_OF_YEAR=37,WEEK_OF_MONTH=2,DAY_OF_MONTH=8,DAY_OF_YEAR=251,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=2,AM_PM=1,HOUR=5,HOUR_OF_DAY=17,MINUTE=32,SECOND=47,MILLISECOND=0,ZONE_OFFSET=19800000,DST_OFFSET=0]
推荐答案
我有一个日历对象,如下所示,代表2014年8月8日。
I have a calendar object as below that represents 08 Aug 2014.
它没有: MONTH = 8
是九月,而不是八月(月份编号从零开始)。
It doesn't: MONTH=8
is September, not August (month numbering starts from zero).
您可以通过注明<$ c $来验证自己c>输出中的DAY_OF_YEAR = 251 。 非闰年的第251天是9月8日。
另一种检查时间戳的方法是将 1410177767000
粘贴到 http://www.epochconverter.com/
Another way to check the timestamp is by pasting 1410177767000
into http://www.epochconverter.com/
这篇关于日历错误的一周的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文