0 votes
308 views
in Java by
How to convert date to long in java? Explain with example.

1 Answer

0 votes
by

I give you  a proper example with running code as fllowing: 

package com;
 
import java.util.Date;
 
public class DateToLong {
 
/**
* @param args
*/
public static void main(String[] args) {
Date currDate = new Date();
long milliSeconds = currDate.getTime();
System.out.println("Current Date: " + currDate + ", long: " + milliSeconds);
}
 
}
 
Output:
Current Date: Mon Sep 23 16:30:02 IST 2013, long: 1379934002557

 

Share:- Whatsapp Facebook Facebook


Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

Categories

...