JQ倒计时天时分秒
<div id="times_wrap" class="time_num">
距离现在时间:
<div class="time_w">
<span id="time_d" class="time"> </span >天
<span id="time_h" class="time"> </span >时
<span id="time_m" class="time"> </span >分
<span id="time_s" class="time"> </span >秒
</div>
</div>
<script type="text/javascript">
$(function(){
show_time();
});
function show_time(){
var time_start = new Date("2013/10/01 00:00:00").getTime();//设定开始时间
var time_end = new Date().getTime(); //设定结束时间(等于系统当前时间)
//计算时间差
var time_distance = time_end - time_start;
if(time_distance > 0){
// 天时分秒换算
var int_day = Math.floor(time_distance/86400000)
time_distance -= int_day * 86400000;
var int_hour = Math.floor(time_distance/3600000)
time_distance -= int_hour * 3600000;
var int_minute = Math.floor(time_distance/60000)
time_distance -= int_minute * 60000;
var int_second = Math.floor(time_distance/1000)
// 时分秒为单数时、前面加零
if(int_day < 10){
int_day = "0" + int_day;
}
if(int_hour < 10){
int_hour = "0" + int_hour;
}
if(int_minute < 10){
int_minute = "0" + int_minute;
}
if(int_second < 10){
int_second = "0" + int_second;
}
// 显示时间
$("#time_d").html(int_day);
$("#time_h").html(int_hour);
$("#time_m").html(int_minute);
$("#time_s").html(int_second);
setTimeout("show_time()",1000);
}else{
$("#time_d").html('00');
$("#time_h").html('00');
$("#time_m").html('00');
$("#time_s").html('00');
}
}
</script>
JQ倒计时天时分秒的更多相关文章
- JS倒计时——天时分秒
HTML代码: <div id="times_wrap" class="time_num"> 距离结束时间: <div cl ...
- js倒计时天时分秒[转]
<script language="JavaScript"> <!-- // function getQueryString(name) { var reg =n ...
- JS时间处理,获取天时分秒
//获取时间的天,小时,分钟,秒 function ToTime(second) { second = second / ; var result ; ) % ; ) % ; * )); ) { re ...
- JS时间处理,获取天时分秒。以及浏览器出现的不兼容问题
//获取时间的天,小时,分钟,秒 function ToTime(second) { second = second / ; var result ; ) % ; ) % ; * )); ) { re ...
- Python:求时间差(天时分秒格式)
传入一个时间戳,以天时分秒格式打印出时间差 输入一个10位的时间戳,求出时间差 def time_diff(timestamp): onlineTime = datetime.datetime.fro ...
- vue倒计时:天时分秒
data数据定义 data () { return { curStartTime: '2019-07-31 08:00:00', day: '0', hour: '00', min: '00', se ...
- 倒计时simple 天时分秒
new Date()new Date(yyyy,mth,dd,hh,mm,ss); //月从0计数 .getTime()返回的是一个long型的毫秒数 毫秒转成 秒 分 时 天 <div id= ...
- JS与React分别实现倒计时(天时分秒)
JS方法 html部分 <div class="clock"> <i></i> 天 <i></i> : <i> ...
- jq 倒计时
引入jq 注 在IE和safari 如果时间出现NAN 将时间格式改为YYYY/MM/DD HH:MM:SS 例:var d2 = new Date("2019/02/18 15:59&qu ...
随机推荐
- c#线程带参数
c#线程带参数 ThreadStart threadStart = delegate { LoadPicture(ds.Tables[0]); }; Thread thread = new Threa ...
- supervisor的安装与简单介绍
1,介绍 Supervisor是一个进程管理工具,官方的说法 用途就是有一个进程需要每时每刻不断的跑,但是这个进程又有可能由于各种原因有可能中断.当进程中断的时候我希望能自动重新启动它,此时,我就需要 ...
- react 表单
import React ,{PropTypes}from 'react'; import { render } from 'react-dom'; const styles={ mb10:{ mar ...
- Servlet学习:实现分页效果的方法
分页的算法:需要定义四个变量,它们有各自的用处int pageSize:每页显示多少条记录int pageNow:希望显示第几页int pageCount:一共有多少页int rowCount:一共有 ...
- js函数表达式和函数声明的区别
我们已经知道,在任意代码片段外部添加包装函数,可以将内部的变量和函数定义"隐 藏"起来,外部作用域无法访问包装函数内部的任何内容. 例如: var a = 2; function ...
- AWS Lambda
AWS Lambda 知识点总结 参考资料:Amazon 名词解释: 事件驱动型计算服务:通过事件来触发的计算服务 Amazon S3存储桶:一项面向Internet的存储服务,可以通过S3 随时在W ...
- js 对象的_proto_
js 对象呢,有个属性叫_proto_,以前没听说过,也没关注,最近看这个原型,就被迫知道了这个东西,js 这里面的东西,真是规定的很奇怪,具体为啥也不知道,就测试发现的,对象的_proto_属性,和 ...
- Linux学习笔记<六>
进程与程序 1.子程序与父程序 PID是进程的ID,PPID是其父进程的ID 登录bash之后,就是获取了一个名为bash的PID,在这个环境上所执行的其他命令,就是其子程序 common@commo ...
- 【ASP.NET程序员福利】打造一款人见人爱的ORM(一)
“很多人都不太认可以第三方ORM,因为考虑的点不够全面,没有大用户群体的ORM有保证,这点是不可否认确是事实.但是往往用户群体大的ORM又有不足之处,今天我们就来聊聊关于ORM的话题,打造 ...
- Forward+
http://aras-p.info/blog/2012/03/02/2012-theory-for-forward-rendering/ http://www.slideshare.net/taka ...