[Solved] NumberFormatException: Invalid long: “588657600000-0400” [closed]


What about split the input string in 2 values ?

Date foo2 = new Date(Long.parseLong("-588657600000") + Long.parseLong("-0400"));

btw, that date is : Mon May 07 16:59:59 BRT 1951 hehehe

EDIT :

this dont check the input values, and assume allways will have the 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);
    }

}

2

solved NumberFormatException: Invalid long: “588657600000-0400” [closed]