In this section, you will learn to convert a date into a timestamp format.
Description of program:
The following program helps you in converting a date into timestamp format. The java.sql.Timestamp class is a thin wrapper around java.util.Date that allows the JDBC API to identify this as an SQL TIMESTAMP value. It adds the ability to hold the SQL TIMESTAMP value in nanoseconds. It also provides formatting and parsing operations to support the JDBC escape syntax for timestamp values. In this example we are just passing the time into an object of java.sql.Timestamp class as an argument.
Here is the code of program:
Output of this program:
C:\date>java DateToMilliseconds Today is 1181648109265
Posted on: June 16, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles