将日期的符串(Tue Mar 26 10:26:08 CST 2019 )转换为Date

public static Date zoneToLocalTime(String dateString) throws ParseException {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        dateString = dateString.replace("Z", " UTC");
        System.out.println(dateString);
        Date date = simpleDateFormat.parse(dateString);
        String d = df.format(date);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date pictureCapturedTime = sdf.parse(d);
        return pictureCapturedTime;
    }

你可能感兴趣的:(Util)