900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 【Date】日期格式转换 Thu Sep 07 00:00:00 GMT+0800 (中国标准时间) 00:00:00

【Date】日期格式转换 Thu Sep 07 00:00:00 GMT+0800 (中国标准时间) 00:00:00

时间:2020-03-23 09:34:27

相关推荐

【Date】日期格式转换  Thu Sep 07  00:00:00 GMT+0800 (中国标准时间) 00:00:00

/*** @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);}}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。