I use the Gregorian calendar to set a specific date and time for the application using the set function from the Gregorian calendar. When I use the getTime () method, it gives me the correct result, however, when I try to access Hour_Of_Day and Minute, it gives the wrong number.
Calendar time = new GregorianCalendar();
time.set(2010, Calendar.JANUARY, 1, 7, 20,0);
hour = time.HOUR_OF_DAY;
minute = time.MINUTE;
An hour gives an output of 11, and a minute gives a value of 12.
Any suggestions on how to fix this? Thanks
source
share