Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fc0571e

Browse files
authoredOct 22, 2022
Create calander.java
1 parent 776639e commit fc0571e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎calander.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.util.Calendar;
2+
public class CalendarExample1 {
3+
public static void main(String[] args) {
4+
Calendar calendar = Calendar.getInstance();
5+
System.out.println("The current date is : " + calendar.getTime());
6+
calendar.add(Calendar.DATE, -15);
7+
System.out.println("15 days ago: " + calendar.getTime());
8+
calendar.add(Calendar.MONTH, 4);
9+
System.out.println("4 months later: " + calendar.getTime());
10+
calendar.add(Calendar.YEAR, 2);
11+
System.out.println("2 years later: " + calendar.getTime());
12+
}
13+
}

0 commit comments

Comments
 (0)
Please sign in to comment.