Categories
android calendar

Getting Year, Month and Date in Android

I am trying to get today’s Year, Month and Date using following code;

Calendar calendar = Calendar.getInstance();
int thisYear = calendar.get(Calendar.YEAR);
Log.d(TAG, "# thisYear : " + thisYear);
int thisMonth = calendar.get(Calendar.MONTH);
Log.d(TAG, "@ thisMonth : " + thisMonth);
int thisDay = calendar.get(Calendar.DAY_OF_MONTH);
Log.d(TAG, "$ thisDay : " + thisDay);

But it gives “2012 for year 1 for month and 28 for date” which is not today’s date. What I have done wrong?