字符串日期到毫秒Android

时间:2016-03-02 10:03:35

标签: android

我有价值String" 2016-02-27T00:49:18.5594825 + 11:00" ,我想转换为格式毫秒。但我不行。这可能代码:

public static long converStringtoMS(String d) {
    SimpleDateFormat sdf = new SimpleDateFormat("MM.dd.yyyy");
    long a = 0;
    try {
        Date date = sdf.parse(d);
        a=date.getTime();
    } catch (ParseException e) {
        e.printStackTrace();
    }

    return a;
}

但这总是0,那么如何正确的代码?

0 个答案:

没有答案
相关问题