-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdatetime2.java
More file actions
23 lines (20 loc) · 755 Bytes
/
datetime2.java
File metadata and controls
23 lines (20 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Calendar;
import java.util.GregorianCalendar;
public class datetime2 {
public static void main(String[] args) {
int day, month, year;
int second , minute, hour;
GregorianCalendar date = new GregorianCalendar();
int a =5;
while (a>=1) {
day = date.get(Calendar.DAY_OF_MONTH);
month = date.get(Calendar.MONTH);
year = date.get(Calendar.YEAR);
second = date.get(Calendar.SECOND);
minute = date.get(Calendar.MINUTE);
hour = date.get(Calendar.HOUR);
System.out.println("Date:"+day+"/"+month+"/"+year);
System.out.println("Time:"+hour+":"+":"+minute+":"+":"+second);
}
}
}