/*** @Description: 将一个诡异的原始字符串格式的日期改成想要的日期格式 * @author liujunran* @date 1月5日 上午11:09:18 * @version V1.0 */package test.datetest;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.Locale;/*** @author irene**/public class OldFormat {public static void main(String[] args) throws ParseException {String dateString = "Thu Sep 07 00:00:00 GMT+0800 (中国标准时间) 00:00:00";SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'Z", Locale.ENGLISH);Date dd = sdf.parse(dateString); //将字符串改为date的格式String resDate= new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(dd);System.out.println(resDate);}}
900字范文,内容丰富有趣,生活中的好帮手!