zoukankan      html  css  js  c++  java
  • 求两个时间的天数差 日期格式为 YYYY-MM-dd

    //+---------------------------------------------------  
    //| 求两个时间的天数差 日期格式为 YYYY-MM-dd   
    //+---------------------------------------------------  
    function daysBetween(DateOne,DateTwo)  
    {   
        var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-'));  
        var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1);  
        var OneYear = DateOne.substring(0,DateOne.indexOf ('-'));  
      
        var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-'));  
        var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1);  
        var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-'));  
      
        var cha=((Date.parse(OneMonth+'/'+OneDay+'/'+OneYear)- Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear))/86400000);   
        return Math.abs(cha);  
    }

  • 相关阅读:
    File操作
    集合
    几个python资料地址
    Case1-用list写shoppingcart
    字符串操作
    运算-Dictionary
    运算-list
    Python数据类型
    标准库和库导入
    Pycharm
  • 原文地址:https://www.cnblogs.com/zifashaonian10000/p/4221829.html
Copyright © 2011-2022 走看看