zoukankan      html  css  js  c++  java
  • 当前日期时间

    self.getCurrentDate1 = function (days, inputDateTime) {
    var date = new Date();
    if (inputDateTime) {
    date = new Date(inputDateTime);
    }
    if (days) {
    var d = new Date(date);
    d.setDate(d.getDate() + days);
    date = d;
    }
    var seperator1 = "-";
    var seperator2 = ":";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
    month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
    strDate = "0" + strDate;//当前日期
    }
    var strHours = date.getHours();
    if (strHours >= 0 && strHours <= 9) {
    strHours = "0" + strHours;
    }
    var strMinutes = date.getMinutes();
    if (strMinutes >= 0 && strMinutes <= 9) {
    strMinutes = "0" + strMinutes;
    }
    var strSeconds = date.getSeconds();
    if (strSeconds >= 0 && strSeconds <= 9) {
    strSeconds = "0" + strSeconds;
    }
    return year + seperator1 + month + seperator1 + strDate//当前日期
    }
    $('#start_time').val(self.getCurrentDate1().split('$')[0]);
    //当前日期加一
    var now = new Date();
    var Tomorrow;
    console.log(now);
    now.setDate(now.getDate() + 1);
    Tomorrow = now.toJSON().split('T')[0];

    $('#end_time').val(Tomorrow);

  • 相关阅读:
    tiled工具使用
    shan
    随笔
    潘大神又一篇
    潘大神的文章
    最近用到这个强大的工具 PhysicsEditor (转)
    为什么要写博客?
    nyoj 998
    欧拉函数
    背包问题
  • 原文地址:https://www.cnblogs.com/benbenjia/p/9916198.html
Copyright © 2011-2022 走看看