zoukankan      html  css  js  c++  java
  • JS计算时间差

    <!DOCTYPE HTML>
    <html lang="en-us">
    <head>
    <meta charset="utf-8"/>
    	<title>JS计算时间差</title>
    	<meta name="generator" content="kingwell"/>
    	<meta name="author" content="kingwell"/>
    	<meta name="keywords" content="kingwell"/>
    	<meta name="description" content="kingwell"/>
    	<style type="text/css"></style>
    	<script type="text/javascript">
    		var t1 = new Date(2013,1,20,12,40,0);
    		var t2 = new Date(2013,3,20,14,40,0);
    		var t3 = t2.getTime() - t1.getTime();
    		
    		var y = Math.floor( t3 / (1000*3600*24*365));
    		
    		var d = Math.floor( t3 / (1000*3600*24));
    
    		var h = Math.floor( t3 / (1000*3600));
    
    		var m = Math.floor( t3 / (1000*60));
    
    		alert("离现在已经有:" +y+" 年 \n离现在已经有:"+d+ " 天\n离现在已经有:"+h+ " 小时\n离现在已经有:" +m + " 分\n");
    	</script>
    </head>
    <body>
    
    </body>
    </html>
    
  • 相关阅读:
    fabu dao fenleizhong
    net core 发布到服务器的方式
    暗示net core
    new post
    gg
    asb
    Nodejs 8.0 踩坑经验汇总
    禁止未发布的博文上首页等
    SortedList
    JSON.stringify 语法实例讲解
  • 原文地址:https://www.cnblogs.com/kingwell/p/2971165.html
Copyright © 2011-2022 走看看