Last active
September 26, 2019 10:04
-
-
Save magicliang/bd7cffab7fa7282ec53d36767bf8cefe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 地区 | |
locale | |
# 校验时区 | |
date -R |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 有时候即使是东八区,也要打印美国的gmt时间,z for zone,见:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html | |
SimpleDateFormat parser=new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); | |
parser.setTimeZone(java.util.TimeZone.getTimeZone("GMT")); | |
Date date = parser.parse("Thu, 26 Sep 2019 03:17:44 GMT"); | |
// 获取utc的 DateTimeFormatter | |
DateTimeFormatter formatter = DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneId.of(ZoneOffset.UTC.getId())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment