Java Program to Add Months to the Current Date

Java Program to Add Months to the Current Date

Java Program to Add Months to the Current Date

// Java program to add months 
// to the current date

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Calendar cal = Calendar.getInstance();

    cal.add(Calendar.MONTH, 3);
    System.out.println("Date after 3 months: " + cal.getTime());
  }
}
Date after 3 months: Sat Jul 02 05:53:39 GMT 2022

Hi, I'm Selva a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on:

Leave a Comment