【Date】日期格式转换 Thu Sep 07 2017 00:00:00 GMT+0800 (中国标准时间) 00:00:00
2018-01-05 11:58
543 查看
/** * @Description: 将一个诡异的原始字符串格式的日期改成想要的日期格式 * @author liujunran * @date 2018年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 2017 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); } }
相关文章推荐
- string datdString='Wed Oct 12 2016 00:00:00 GMT+0800 (中国标准时间)'将字符串转化为date类型,格式2016-10-12
- JAVA将字符串Sat Nov 25 2017 00:00:00 GMT+0800 (中国标准时间)转成标准时间
- 格林时间:Thu May 18 2017 00:00:00 GMT+0800 (中国标准时间) 格式转换
- 2017 10:35:13 GMT+0800 (中国标准时间)
- JS格式化Thu May 12 2017 08:00:00 GMT+0800 (中国标准时间)
- Fri Sep 08 2017 17:03:02 GMT+0800 (中国标准时间)------- 格式的时间转换
- Java转换Json日期/Date(1487053489965+0800)/格式以及js时间格式 Tue Feb 14 2017 14:06:32 GMT+0800
- easyui datebox 时间格式化(Mon Jan 02 00:00:00 cst 2017)
- Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)转化为yyyy-MM-dd(通过js)
- Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)转化为yyyy-MM-dd(通过js)
- 微信小程序 GMT+0800 (中国标准时间) WXSS 文件编译错误
- mysql日期函数From_unixtime及UNIX_TIMESTAMP及DATE_FORMAT(后者只能格式化标准日期格式,时间戳的不行)
- 微信小程序 GMT+0800 (中国标准时间) WXSS 文件编译错误
- mysql日期函数From_unixtime及UNIX_TIMESTAMP及DATE_FORMAT(后者只能格式化标准日期格式,时间戳的不行)
- 将中国标准时间转为日期格式
- js 格式化 extjs 的时间对象 Thu May 12 2016 08:00:00 GMT+0800 (中国标准时间)
- 标准日期、中国标准时间、时间戳、毫秒数互转
- 微信小程序 GMT+0800 (中国标准时间) WXSS 文件编译错误
- 中国标准时间Mon, 24 Jul 2017 15:31:05 +0800格式化转换 js
- Mon Jun 06 2016 08:00:00 GMT+0800 (中国标准时间)