Home Java Beginners Example of Date class



Example of Date class
Posted on: June 7, 2007 at 12:00 AM
This section, you will learn how to create the current date.

Example of Date class

     

We can use Date class to use current date. In this program we are creating a Date object and by using it we are going to display the current date and time. It implements Serializable, Cloneable, Comparable interfaces. Its known subclasses are Date, Time, Timestamp

 

 

 

Code of a program is given below: 

import java.util.*;

public class  DateDemo{
  public static void main(String[] args) {
  Date d=new Date();
  System.out.println("Today date is "+ d);
  }
}

Output of this program is given below:

Today date is Tue Dec 19 22:14:46 GMT+05:30 2006

Download this example

Related Tags for Example of Date class:
ccomclassdateinterfacetimeobjectclassesinterfacestimestampdisplaycloneserialusingintriathissubclassprogramtoramsseeitserializablecanlispluseimcomparablececurrentinnosubasstamntplayparcajispaceclesfacessubclassesemmeobjprocreatingssuspatkisimemplgoeaandarstampzssrirentamthcloneablebcstabablatidispfacejepleplprndonomogro


More Tutorials from this section

Ask Questions?    Discuss: Example of Date class   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.