/**
* FIXME
* @param oldVersion 旧版本的时间戳
* @return 旧版本时间戳减掉10分钟后的数值
* @throws ParseException
* @auther dongruofan@nvlbs.com
*/
public String parseVersionMinTen(String oldVersion) throws ParseException {
SimpleDateFormat myFmt = new SimpleDateFormat("yyyyMMddHHmmss");
Date oldDate = myFmt.parse(oldVersion);
long utc = oldDate.getTime() / 1000;
long newUtc = utc - 600;
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(newUtc * 1000);
Date newDate = calendar.getTime();
String newVersion = (myFmt.format(newDate));
return newVersion;
}
编写参照:http://blog.csdn.net/caoyinghui1986/archive/2008/04/18/2303570.aspx
UTC与字符串的相互转换
最新推荐文章于 2022-11-11 15:57:51 发布