java - NumberFormatException: Invalid long: "588657600000-0400" -
-588657600000-0400
getting response this. not able convert date format invalid long.
new date(long.parselong("/date(-588657600000-0400)/"));
is there anyway, can construct new date object when response string in such formats. question related 1 asked earlier. java.lang.long.parselong exception
the exception thrown here "04-09 01:39:25.793: e/androidruntime(8011): java.lang.numberformatexception: invalid long: "588657600000-0400"
i tried @ calendar class, http://docs.oracle.com/javase/6/docs/api/java/util/calendar.html not find method me date object without passing long.
what split input string in 2 values ?
date foo2 = new date(long.parselong("-588657600000") + long.parselong("-0400"));
btw, date : mon may 07 16:59:59 brt 1951
hehehe
edit :
this dont check input values, , assume allways have minus
import java.util.date; public class mimimi { public static void main(string[] args) { string input = "/date(-588657600000-0400)/"; input = input.replace("/date(", ""); input = input.replace(")/", ""); string[] pair = input.split("-"); system.out.println(pair[1]); system.out.println(pair[2]); date foo = new date(long.parselong("-" + pair[1]) + long.parselong("-" + pair[2])); system.out.println(foo); } }
Comments
Post a Comment