时间格式转换

public static void main(String[] args){

        SimpleDateFormat dateFormatGMT = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss", Locale.US);

        dateFormatGMT.setTimeZone(TimeZone.getTimeZone("GMT+8"));

       // String str = "Sat Apr 25 2015 00:00:00 GMT+0800 (CST)";

        String str = "Sat Apr 25 2015 00:00:00 GMT+0800 (CST)";

        try {

            Date date = dateFormatGMT.parse(str);

            System.out.println(date);

        }catch (Exception e){

            e.printStackTrace();

        }

    }


你可能感兴趣的:(时间格式转换)