Convert .net Date To Java Date
In my code, I'm receiving a date formatted: /Date(-82135555200000-0800)/ How can I parse it in Java to become a Java date?
Solution 1:
In the string
/Date(-82135555200000-0800)/
use this line of code to remove non-number element from the String
StringtempDate= data.getDate().replaceAll("\\D+", "");
what you actually be interested in should be 8213555520000
. you would need first 15 digits to get the date from it as the given time is in milliseconds, you can do whatever you want with it.
Many languages follow this convention so dealing with date becomes easy
Datedate = newDate(Long.parseLong(""+tempDate));
Or as following
String dateAsText = newSimpleDateFormat("yyyy-MM-dd HH:mm:ss")
.format(newDate(821355552*10000L));
Post a Comment for "Convert .net Date To Java Date"