当前位置 : 主页 > 编程语言 > java >

Java获取GMT8时间

来源:互联网 收集:自由互联 发布时间:2022-08-10
/** * Description: 获取GMT8时间 * @return 将当前时间转换为GMT8时区后的Date */ public static null; try "GMT+8"),Locale.CHINESE); Calendar day = Calendar.getInstance(); day.set(Calendar.YEAR, cal.get(Calendar.YEAR)); day.set(C
/**
* Description: 获取GMT8时间
* @return 将当前时间转换为GMT8时区后的Date
*/
public static
null;
try
"GMT+8"),Locale.CHINESE);
Calendar day = Calendar.getInstance();
day.set(Calendar.YEAR, cal.get(Calendar.YEAR));
day.set(Calendar.MONTH, cal.get(Calendar.MONTH));
day.set(Calendar.DATE, cal.get(Calendar.DATE));
day.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY));
day.set(Calendar.MINUTE, cal.get(Calendar.MINUTE));
day.set(Calendar.SECOND, cal.get(Calendar.SECOND));
gmt8 = day.getTime();
catch
"获取GMT8时间 getGMT8Time() error !");
e.printStackTrace();
null;
}
return
}
上一篇:JAVA 连接MySQL
下一篇:没有了
网友评论