Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Java Date Example

  1. /*
  2. Java Date example.
  3. This Java Date example describes how Java Date class
  4. is being used in Java language.
  5. */
  6.  
  7. import java.util.*;
  8.  
  9. /*
  10. Most of the methods of the Java Date class have been deprecated.
  11. Java Calendar class should be used for date manipulation instead.
  12. */
  13.  
  14. public class JavaDateExample{
  15.    
  16.     public static void main(String args[]){
  17.        
  18.         /*
  19.         Create date object with current date and time.
  20.         */
  21.        
  22.         Date date = new Date();
  23.         System.out.println("Today is " + date);
  24.        
  25.     }
  26.  
  27. }
  28.  
  29. /*
  30. OUTPUT of the above given Java Date Example would be:
  31. Today is Sat Feb 04 18:10:21 IST 2005
  32. */
Your rating: None Average: 1 (1 vote)
Share this

Post new comment