Home Java Java-get-example Get Time Stamp



Get Time Stamp
Posted on: October 23, 2008 at 12:00 AM
In the example given below we will learn how to display current time. getTime() method returns the number of milliseconds represented by Date object that will be used as argument to create object of java.sql.Time class.

Get Time Stamp

     

In the example given below we will learn how to display current time. getTime() method returns the number of milliseconds represented by Date object that will be used as argument to create object of java.sql.Time class.

 

 

 

 

Here is the code:

public class GetTimeStamp {

  public static void main(String[] args) {
  java.util.Date time = new java.util.Date();
  System.out.println(new java.sql.Time(time.getTime())); 
  }
}

 

Output will be displayed as:


Download Source Code

 

Related Tags for Get Time Stamp:
javasqlcclassdatetimeobjectmethodsedgetdisplaynumberreturncreateexampletolearnexamargumenteareillispluseimcurrentinasmmillisecondsntplayjispclesmillisecondmehowobjxaxampsurnspatishaimellivmplpregettimeeaarreprsecondsvattssrenthcondavbelohatdispjepleplprmindono


More Tutorials from this section

Ask Questions?    Discuss: Get Time Stamp  

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.