UTC时间转换字符时间:
new SimpleDateFormat("yyyyMMddhhmmss").format(new Date(Long.parseLong("1251358989")*1000));
字符串时间转换UTC
String str = "201104141302";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmm");
long millionSeconds = sdf.parse(str).getTime();//毫秒
System.out.println(millionSeconds);
UTC时间算距离1970年1月1日的天数
int offset = TimeZone.getDefault().getOffset(1375718399);
long day = (1375718399 + offset / 1000) / 86400;
new SimpleDateFormat("yyyyMMddhhmmss").format(new Date(Long.parseLong("1251358989")*1000));
字符串时间转换UTC
String str = "201104141302";
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddhhmm");
long millionSeconds = sdf.parse(str).getTime();//毫秒
System.out.println(millionSeconds);
UTC时间算距离1970年1月1日的天数
int offset = TimeZone.getDefault().getOffset(1375718399);
long day = (1375718399 + offset / 1000) / 86400;
本文介绍了如何将字符时间转换为UTC时间,并计算了从1970年1月1日至给定时间的天数。内容包括时间格式化、日期解析及时间差计算等关键步骤。
1823

被折叠的 条评论
为什么被折叠?



