-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdate_function.java
More file actions
31 lines (25 loc) · 833 Bytes
/
Copy pathdate_function.java
File metadata and controls
31 lines (25 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package function;
import java.util.Calendar;
import java.util.GregorianCalendar;
public final class date_function {
void CheckData()
{
int day,month,year;
int second,minute,hour;
GregorianCalendar date = new GregorianCalendar();
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("Current date is "+day+"/"+(month+1)+"/"+year);
System.out.println("Current time is "+hour+" : "+minute+" : "+second);
}
public date_function(){
CheckData();
}
public static void main(String[] args) {
new date_function();
}
}