Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTC时间转换错误 #127

Open
bobby-walle opened this issue Dec 20, 2017 · 0 comments
Open

UTC时间转换错误 #127

bobby-walle opened this issue Dec 20, 2017 · 0 comments

Comments

@bobby-walle
Copy link

bobby-walle commented Dec 20, 2017

大神的UTC时间转换太暴力了,可以这样
@Nullable
public static String subStandardTime(String time) throws ParseException {
SimpleDateFormat formatUTC = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
Date date = formatUTC.parse(time.replace("Z", " UTC"));
SimpleDateFormat formatGST = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatGST.format(date);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant