1、UTC时间是l零时区的时间。(时间协调时间)
CST时间是四大时区的时间,(中央标准时间)
分别是:
Central Standard Time (USA) UT-6:00(美国cst时间:零区时减6个小时) Central Standard Time (Australia) UT+9:30(澳大利亚cst:加9个半小时) China Standard Time UT+8:00(中国cst:加8个小时) Cuba Standard Time UT-4:00 (古巴cst:减4个小时)
.
GMT=UTC
2、UTC(GMT)时间与CST时间的转换
public Date getCST(String strGMT) throws ParseException { DateFormat df = new SimpleDateFormat("EEE, d-MMM-yyyy HH:mm:ss z", Locale.ENGLISH);
public String getGMT(Date dateCST) { DateFormat df = new SimpleDateFormat("EEE, d-MMM-yyyy HH:mm:ss z", Locale.ENGLISH); df.setTimeZone(TimeZone.getTimeZone("GMT")); // modify Time Zone. return(df.format(dateCST));
一般我们的web请求的请求头中的Date格式类似于:Thu, 02 Jul 2015 05:49:30 GMT ,能够对应的把上面的格式调整为:
DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", Locale.ENGLISH);
这样的方式能够灵活控制时间的格式,信息量较全,推荐使用。
|