hello, i've a date in the format yyyy-mm-dd and i want to add a day to it.
below is my code, but i don't know why the answer isn't correct. the output is 1999-1-1 (which is wrong!)
pls advise
String visitdate="1999-12-31";
SimpleDateFormat df = new SimpleDateFormat("yyyy-mm-dd"
;
Date vdate = df.parse(visitdate);
Calendar rightnow = Calendar.getInstance();
rightnow.setTime(vdate);
rightnow.add(Calendar.DATE,1);
System.out.println(""+rightnow.get(Calendar.YEAR)+"-"+rightnow.get(Calendar.MONTH)+"-"+rightnow.get(Calendar.DAY_OF_MONTH));
below is my code, but i don't know why the answer isn't correct. the output is 1999-1-1 (which is wrong!)
pls advise
String visitdate="1999-12-31";
SimpleDateFormat df = new SimpleDateFormat("yyyy-mm-dd"
Date vdate = df.parse(visitdate);
Calendar rightnow = Calendar.getInstance();
rightnow.setTime(vdate);
rightnow.add(Calendar.DATE,1);
System.out.println(""+rightnow.get(Calendar.YEAR)+"-"+rightnow.get(Calendar.MONTH)+"-"+rightnow.get(Calendar.DAY_OF_MONTH));