Program To Get Current Date And Time In Java

LEVEL: Beginner

Whats in this post?

  1. Code
  2. Output
  3. Background and Explanation of the code

Code


To copy code: Click  View Source “View Source” on the right of this code snippet.

Background and Explanation of the code


Here, the class Date has been used to show the current time and date. The program shows the current date and time and calculates the milliseconds past since January 1, 1970.