得到的字符串是:Sat Oct 22 22:41:30 +0800 2011
怎么将他转换成 10-22 22:41?
------解决方案--------------------
- Java code
public static void main(String[] args) throws Exception { String str = "Sat Oct 22 22:41:30 +0800 2011"; Date date = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy",Locale.US).parse(str); System.out.println(new SimpleDateFormat("MM-dd HH:mm").format(date)); }
------解决方案--------------------
SimpleDateFormat dateFormat=new SimpleDateFormat();
DateFormat sFormat=new SimpleDateFormat("yyyy/MM/dd");