Display System Date and Time: Java


This Java Video Tutorial shows how to extract and display system date(with time stamp).

Inorder to make this program work, you MUST include or import Date class of util package.

  import java.util.Date;

Video Tutorial: Extract and display System Date and Time: Java


[youtube https://www.youtube.com/watch?v=XwQfh8i81r4]

YouTube Link: https://www.youtube.com/watch?v=XwQfh8i81r4 [Watch the Video In Full Screen.]




We create an object of class Date, and just display its content.

Full Source Code:(SysDate.java)

1
2
3
4
5
6
7
8
9
10
11
12
import java.lang.*;
import java.util.Date;
 
class SysDate
{
public static void main(String args[])
{
Date d1 = new Date();
 
System.out.println(d1);
}
}

Output:
Sun Sep 11 17:33:50 IST 2011

Leave a Reply

Your email address will not be published. Required fields are marked *