R
roy
Hi,
I got incorrect date using the following code.
Calendar rightnow = Calendar.getInstance();
Date d = new Date();
System.out.println(d.toString());
rightnow.setTime(d);
System.out.println(rightnow.get(Calendar.YEAR));
System.out.println(rightnow.get(Calendar.MONTH));
System.out.println(rightnow.get(Calendar.DAY_OF_MONTH));
The output is:
Tue Oct 14 19:46:53 EDT 2003
2003
9
14
Does anyone know why rightnow.get(Calendar.MONTH) gives me 9, but not 10?
Thanks a lot
I got incorrect date using the following code.
Calendar rightnow = Calendar.getInstance();
Date d = new Date();
System.out.println(d.toString());
rightnow.setTime(d);
System.out.println(rightnow.get(Calendar.YEAR));
System.out.println(rightnow.get(Calendar.MONTH));
System.out.println(rightnow.get(Calendar.DAY_OF_MONTH));
The output is:
Tue Oct 14 19:46:53 EDT 2003
2003
9
14
Does anyone know why rightnow.get(Calendar.MONTH) gives me 9, but not 10?
Thanks a lot