如何将timestamp字符串转换为毫秒?

eng*_*med 2 time android

我怎样才能将这个来自android中的json数据的时间和日期转换为毫秒?

2013-09-19T03:27:23+01:00
Run Code Online (Sandbox Code Playgroud)

什么是T ??

Ket*_*hir 6

不确定,and what's the meaning of T ??但你可以使用以下代码来获得毫秒.

String dateString="2013-09-19T03:27:23+01:00";
        if (dateString != null) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
            Date testDate = null;
            try {
                testDate = sdf.parse(dateString);
            } catch (ParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            System.out.println("Milliseconds==" + testDate.getTime());

        } 
Run Code Online (Sandbox Code Playgroud)