Monday 25 February 2013

Get Next Date In Java

Leave a Comment

public class NextDate
{ public static void main(String[] args)
{
  int oneDay = 1000 * 60 * 60 * 24;
  Date date = new Date();
  SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
  String currDate = dateFormat.format(date.getTime());
  String nextDate = dateFormat.format(date.getTime() + oneDay);
  System.out.println("Currnent date: " + currDate);
  System.out.println("Next date: " + nextDate);
}
}

0 comments:

Post a Comment