淘宝抢购倒计时(时、分、秒)
来源:互联网 发布:电脑版淘宝微淘哪里看 编辑:程序博客网 时间:2024/05/04 18:21
@Override
public void run() {
toDataCount();
}
};
private void toDataCount() {
SimpleDateFormat df = new SimpleDateFormat("MM-dd HH:mm:ss");
try {
String date = df.format(new Date());
Date d2 = df.parse(date);//系统时间
Date d1 = df.parse(AppConfig.getTmLongToStr_(gameInfo.getStartDateUnix() * 1000));//服务器获取时间
long diff = d1.getTime() - d2.getTime();//这样得到的差值是微秒级别
long days = diff / (1000 * 60 * 60 * 24);
long hours = (diff - days * (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
long minutes = (diff - days * (1000 * 60 * 60 * 24) - hours * (1000 * 60 * 60)) / (1000 * 60);
long second = (diff - days * (1000 * 60 * 60 * 24) - hours * (1000 * 60 * 60) - minutes * (1000 * 60)) / 1000;
if (days <= 0 && hours <= 0 && minutes <= 0 & second <= 0) {
time_tv.setText(hours + ":" + minutes + ":" + second);
handler.removeCallbacks(timeRunnable);
} else {
time_tv.setText(hours + ":" + minutes + ":" + second);
handler.postDelayed(timeRunnable, 1000);
}
} catch (Exception e) {
}
}
handler.post(timeRunnable);//调用倒计时
- 淘宝抢购倒计时(时、分、秒)
- 倒计时(天,时,分,秒)
- 倒计时(时、分、秒)面板
- jQuery 倒计时 天、时、分、秒倒计时
- 倒计时 多个同时支持 -- 显示*(时:分:秒)
- JS实现倒计时(时、分,秒)
- JS实现的倒计时(时、分、秒)
- JS实现倒计时(时、分,秒)
- JS 倒计时实现代码(时、分,秒)
- JS实现倒计时(天数,时,分,秒)
- iOS实现倒计时显示 时 分 秒
- JS实现倒计时(天、时、分,秒)
- iOS实现倒计时显示 时 分 秒
- iOS 实现倒计时显示 时 分 秒
- android 仿淘宝限时抢购倒计时
- JS实现倒计时精确到天数,时,分,秒或者精确到时、分、秒(小时数累加)
- Android 抢购类倒计时实现 (包括天数,小时,分钟,秒)
- 秒杀活动倒计时 倒计时的实现,显示剩余天、时、分、秒
- 3.1 数学:172.Factorial Trailing Zeroes(Leetcode)
- linux查看和关闭后台执行程序
- 渐进增强 VS 优雅降级
- 听说云服务器_也可以竞价了_1折起售_怎么买更划算??
- CentOS 7 python Opencv2.4.13安装记录 Install opencv2.4.13 python in centos 7
- 淘宝抢购倒计时(时、分、秒)
- c# Http Get Post Put Delete类整理
- 热修复Tinker的使用 + TinkerPatch补丁管理平台 gradle接入
- Spark2.2 Worker原理剖析图解及源码剖析
- paperweekly-迁移学习
- CORBA概述
- Spring-ApplicationContext
- 移动端H5页面截图【含 domtoimage、html2canvas 】
- Idea