Choose Your Language

Thursday 27 June 2013

Java Program to print Tomorrows Date and Time

import java.util.Calendar;
import java.util.Date;

public class TomorrowsDateTime {
    public static void main(String a[]){
        Calendar calendar = Calendar.getInstance();
        Date today = calendar.getTime();
        calendar.add(Calendar.DAY_OF_YEAR, 1);
        Date tomorrow = calendar.getTime();         
        System.out.println("Today's Date Time is  "+today);
        System.out.println("Tomorrow's Date Time is  "+tomorrow);         
    }
}

output:
Today's Date Time is  Thu Jun 27 22:26:44 IST 2013
Tomorrow's Date Time is  Fri Jun 28 22:26:44 IST 2013

No comments:

Post a Comment