我正在将具有“1520056800”的字符串转换为长日期。但我得到 NumberFormatException 来转换它
请帮我。
long expiryDateMS = Long.parseLong(responseArray[0].replaceAll(" ", ""));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-mm-dd");
Date date = new Date(expiryDateMS);
堆栈跟踪
09-02 00:52:28.984: E/AndroidRuntime(12025): Caused by: java.lang.NumberFormatException: 1520056800
09-02 00:52:28.984: E/AndroidRuntime(12025): at java.lang.Long.parse(Long.java:353)
09-02 00:52:28.984: E/AndroidRuntime(12025): at java.lang.Long.parseLong(Long.java:344)
09-02 00:52:28.984: E/AndroidRuntime(12025): at java.lang.Long.parseLong(Long.java:311)
09-02 00:52:28.984: E/AndroidRuntime(12025): at com.example.astrill_openvpn.MainOnOffActivity.onCreate(MainOnOffActivity.java:99)
09-02 00:52:28.984: E/AndroidRuntime(12025): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-02 00:52:28.984: E/AndroidRuntime(12025): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)