Program That Shows Usage Of Java Calendar Class To Get Current Time And Date

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


The program uses the java class Calendar and prints different date and time related information.
Output:
Current Hour in 12 hour format is
Current Hour in 24 hour format is
Current Minute is
Current Second is
Current Millisecond is
Current Year is
Current Month is
Current Date is