Calendar.month And Year Broke?
Im trying to get the number of the month (from 1 to 12) of the year and the year. But when i use that code it give me only the number 2 for the month and the number 1 for the year.
Solution 1:
You are assigning static value of field . Whereas you have to get the value at field from Calender
. So your code should look like as:
Calendar calendar=Calendar.getInstance();
Calendario.gprec=calendar.get(Calendar.DAY_OF_MONTH);
Calendario.mprec=calendar.get(Calendar.MONTH);
Calendario.aprec=calendar.get(Calendar.YEAR);
Post a Comment for "Calendar.month And Year Broke?"