---
title: "带时区格式字符串时间转换"
author: "programmerwind"
date: "2015-06-11T17:47:12Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2015-06-11T17:47:12Z"
id: 2219004
url: "https://programmerwind.iteye.com/blog/2219004"
---

String tt="Apr 7, 2015 2:52:09 PM";  
      Date now=new Date();  
      DateFormat mediumDateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,Locale.US);   
    try {  
   mediumDateFormat.parse(tt);  
 // String nn=mediumDateFormat.format(now);  
 // System.out.println("now =="+nn);  
   Date d=mediumDateFormat.parse(tt);  
    
    
  System.out.println("d =="+new SimpleDateFormat("yyyy-MM-dd HH:mm").format(d));  
 } catch (Exception e) {  
  e.printStackTrace();  
 }  
 }