0

I have next code:

Calendar cal = Calendar.getInstance();
        cal.add(Calendar.YEAR, mYear); /2011
        cal.add(Calendar.MONTH, mMonth); /04
        cal.add(Calendar.DAY_OF_MONTH, mDay);/13 
        cal.add(Calendar.HOUR, mHour); /11
        cal.add(Calendar.MINUTE, mMinute); /53 
    System.out.println("Cal time "+ cal.getTimeInMillis());
    System.out.println("System time " +System.currentTimeMillis());

cal time 64775494376227 System time 1302724616231 What's wrong in my code?

Erik
  • 935
  • 11
  • 28
Divers
  • 9,531
  • 7
  • 45
  • 88

1 Answers1

2

The problem is Calendar.getInstance() is already initialized to the current date/time. You're returning the millis time for for sometime in 4022...not 2011. See the JavaDoc for more info.

Chris Thompson
  • 35,167
  • 12
  • 80
  • 109