CAlendar in java

HI
Calendar c = Calendar.getInstance();
System.out.println("month and year is " + c.MONTH+ "      "+c.YEAR );

gives me
month and year is 2      1

y?

Thx


       
LVL 3
applekannaAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
c.get(Calendar.YEAR);
c.get(Calendar.MONTH);
0
 
jimmackConnect With a Mentor Commented:
You're displaying the constants from the class, not the values contained in the object "c".

0
 
applekannaAuthor Commented:
I want toget 11 and 2003
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
jimmackCommented:
Watch out for the strange thing about months.  They're numbered 0 .. 11 (not 1 .. 12) ;-)
0
 
objectsCommented:
> I want toget 11 and 2003

System.out.println("month and year is " + (c.get(Calendar.MONTH)+1)+ "      "+c.get(Calendar.YEAR) );
0
 
applekannaAuthor Commented:
Thx for you qwik help
0
 
jimmackCommented:
;-)
0
 
CEHJCommented:
8-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.