In this section you will learn to convert the date into a long format. The java.util package provides the functionality to convert a date type into a long type.
Description of program:
The following program helps you in converting a date into a long type. First of all you need a date that needs to be converted. The DateFormat is a constructor to create a new date format. The getTime() method is used to convert the given date into a long type. This method returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. which is of long type.
Here is the code of program:
Output of this program:
C:\date>java DateToLong Today is 1181500200000
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 16, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles