cst時間書寫方式?
一、CST格式字符串轉(zhuǎn)換成yyyy-MM-dd HH:mm:ss格式的時間
1、java代碼
12
3
4
5
6
String dateStr = "Mon Oct 26 15:19:15 CST 2020";
DateFormat cstFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat gmtFormate = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
Date dateTime = gmtFormate.parse(dateStr);
String dateString = cstFormate.format(dateTime);
System.out.println(dateString);
2、轉(zhuǎn)換結(jié)果
1
2020-10-26 15:19:15