-3

plz I want your help with java program

this program ask user to enter (day,month,year) of current day and give him the next day (day,month year ) . for example :

enter the day: 28
enter the month: 2
enter the year: 2014

the next day is: 1/3/2014
qqilihq
  • 10,794
  • 7
  • 48
  • 89
  • 3
    you want to write you whole program? have you tried yourself? – Jakub H Feb 28 '14 at 10:47
  • Consider using a `GregorianCalendar`. Btw; question is not specific to netbeans (concerning the tag). – qqilihq Feb 28 '14 at 10:49
  • get a Calendar instance, use `Calendar.set(int year, int month, int date)` , to set the input date and use `add(int field, int amount)` to increment the desired field – Zeeshan Feb 28 '14 at 10:50

1 Answers1

0

Use Calendar.add to add one day to current date. Sample code here:

Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, 1);
System.out.println(c.getTime().toString());
Weibo Li
  • 3,565
  • 3
  • 24
  • 36