Convert Date to Long
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: