Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert Date represented as a String to milliseconds? [duplicate]

Tags:

java

date

Possible Duplicate:
how to convert java string to Date object

In my Java code I have input String like 05.10.2011 which I need to convert to milliseconds.

So:

String someDate = "05.10.2011"; 

I have to convert to match milliseconds format.

like image 996
user696847 Avatar asked Dec 12 '11 16:12

user696847


1 Answers

String someDate = "05.10.2011";
SimpleDateFormat sdf = new SimpleDateFormat("MM.dd.yyyy");
Date date = sdf.parse(someDate);
System.out.println(date.getTime());
like image 122
dku.rajkumar Avatar answered Sep 19 '22 09:09

dku.rajkumar