Java Get Tomorrow Date
In this Java tutorial, we learn how to implement a Java program to get the tomorrow Date value in Java programming language.
How to get tomorrow Date in Java
In this first step, we create a new Java class named DateUtil, and implement the static method named getTomorrowDate() which return the tomorrow Date object as the following Java code.
DateUtil.java
import java.util.Calendar;
import java.util.Date;
public class DateUtil {
/**
* This method to return the Date of tomorrow.
* @return the tomorrow Date object
*/
public static Date getTomorrowDate() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, 1);
return calendar.getTime();
}
}
In the following example Java program, we learn how to use the above DateUtil class to get the Date object of tomorrow.
GetTomorrowDateExample.java
import java.util.Date;
public class GetTomorrowDateExample {
public static void main(String... args) {
// Get Tomorrow Date
Date tomorrow = DateUtil.getTomorrowDate();
System.out.println("Tomorrow: " + tomorrow);
}
}
Tomorrow: Thu Aug 18 20:53:28 ICT 2022
Happy Coding 😊
Related Articles
Java Get First Day of Month from Specified Date
Java Get Last Date of Current Month
Java Get Last Date of Current Year
Java Get Last Date of Specified Month
Java Get Last Date of Specified Year
Java Check if Calendar is Week Day or Weekend Day
Java Check if Date is Week Day or Weekend Day
Java Check if Today is Week Day or Weekend Day
Java Convert Date to Start of Day Time
Java Convert Date to End of Day Time
Java Get First Date of Current Year