We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96bd46f commit 00d4ee9Copy full SHA for 00d4ee9
DateAndTime.java
@@ -0,0 +1,21 @@
1
+import java.util.*;
2
+
3
+public class DateAndTime {
4
+ public static void main(String[] args){
5
+ int day, month, year;
6
+ int second, minute, hour;
7
8
+ GregorianCalendar date = new GregorianCalendar();
9
10
+ day = date.get(Calendar.DAY_OF_MONTH);
11
+ month = date.get(Calendar.MONTH);
12
+ year = date.get(Calendar.YEAR);
13
14
+ second = date.get(Calendar.SECOND);
15
+ minute = date.get(Calendar.MINUTE);
16
+ hour = date.get(Calendar.HOUR);
17
18
+ System.out.println("Date is " + day + "/" + (month+1) + "/" + year);
19
+ System.out.println("Time is " + hour + ":" + minute + ":" + second);
20
+ }
21
+}
0 commit comments