I have a python date formatted like this 1418572798.498
within a string.
In Java the dates are formatted like this 1418572798498
.
How to convert this string to Java date? Is there any third party library to use for the conversion?
I have a python date formatted like this 1418572798.498
within a string.
In Java the dates are formatted like this 1418572798498
.
How to convert this string to Java date? Is there any third party library to use for the conversion?
Try something like:
String number = "1418572798.498";
long d = Long.parseLong(number.replace(".", ""));
System.out.println(d + " " + new Date(d));
Output:
1418572798498 Sun Dec 14 21:29:58 IST 2014
Do this:
float time = Float.parseFloat(string);
long actual_time = (int)(time*1000);
Date d = new Date(actual_time);