开发者

Android: Gregorian Calendar issue

开发者 https://www.devze.com 2023-04-04 19:26 出处:网络
I am getting confuse with using Gregorian. I am using GregorianCalendar to get the current date and setting the future date.

I am getting confuse with using Gregorian.

I am using GregorianCalendar to get the current date and setting the future date.

The current month : it prints me the mo开发者_如何学编程nth as 8 rather 9 where 9 is my expected month. The current year : it prints me the year in 2011 which is correct.

What is going wrong.

The code I use is GregorianCalender.getInstance(); to get the current date.


Using the jdk's calendar is a little confusing and you'll have to write a lot of code. Instead try a library called joda - http://joda-time.sourceforge.net/

0

精彩评论

暂无评论...
验证码 换一张
取 消