Skip to content

Commit 5a8fc34

Browse files
committed
added Date and time Program in Java
1 parent bbe3b15 commit 5a8fc34

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

DateAndTime.java

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import java.util.*;
2+
public class DateAndTime {
3+
public static void main(String[] args)
4+
{
5+
Calendar now = Calendar.getInstance();
6+
System.out.println();
7+
System.out.println("Current full date and time is : " + (now.get(Calendar.MONTH) + 1) + "-"
8+
+ now.get(Calendar.DATE) + "-" + now.get(Calendar.YEAR) + " "
9+
+ now.get(Calendar.HOUR_OF_DAY) + ":" + now.get(Calendar.MINUTE) + ":"
10+
+ now.get(Calendar.SECOND) + "." + now.get(Calendar.MILLISECOND));
11+
System.out.println();
12+
}
13+
}

0 commit comments

Comments
 (0)