• 时间


    //当天
    function writeCurrentDate() {
        var now = new Date();
        var year = now.getFullYear(); //得到年份
        var month = now.getMonth();//得到月份
        var date = now.getDate();//得到日期
        var day = now.getDay();//得到周几
        var hour = now.getHours();//得到小时
        var minu = now.getMinutes();//得到分钟
        var sec = now.getSeconds();//得到秒
        var MS = now.getMilliseconds();//获取毫秒
        var week;
        month = month + 1;
        if (month < 10) month = "0" + month;
        if (date < 10) date = "0" + date;
        if (hour < 10) hour = "0" + hour;
        if (minu < 10) minu = "0" + minu;
        if (sec < 10) sec = "0" + sec;
        if(MS < 100){
            MS = "0" + MS
        };
        var arr_week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
        week = arr_week[day];
        var time = "";
        //time = year + "-" + month + "-" + date  + " " + hour + ":" + minu + ":" + sec;
        time = year + "-" + month + "-" + date  + " " + '23' + ":" + '59' + ":" + '59';
        //当前日期赋值给当前日期输入框中(jQuery easyUI)
    
        $("#PicUp_endTime").val(time);
        //设置得到当前日期的函数的执行间隔时间,每1000毫秒刷新一次。
        // var timer = setTimeout("writeCurrentDate()", 1000);
    }
    //三天前
    function threeday(){
        var date = new Date();
        date.setDate(date.getDate() - 3);//获取3天前的日期
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        if( month <10){
            month = '0' + month;
        }
        var day = date.getDate();
        if( day < 10){
            day = '0' + day;
        }
        var time = year + "-" + month + "-" + day  + " " + '00' + ":" + '00' + ":" + '00';
        $("#PicUp_startTime").val(time);
    }
    var nowdays = new Date();
    var year = nowdays.getFullYear();
    var month = nowdays.getMonth();
    if(month==0){
        month = 12;
        year = year-1;
     
    }
    if(month<10){
        month = '0'+month;
    }
                
    var myDate = new Date(year,month,0);
     
    var startDate = year+'-'+month; //上个月第一天
    var endDate = year+'-'+month+'-'+myDate.getDate()+' 23:59:00';//上个月最后一天
    console.log(endDate)
  • 相关阅读:
    可爱精灵宝贝 DP/爆搜
    那些年留的坑
    吃某种零食ing
    NOIP模拟测试13
    NOIP模拟测试12
    NOIP模拟测试11
    大佬 (数学)
    BZOJ3331 BZOJ2013 压力
    LOJ2586 APIO2018 选圆圈
    BZOJ3398 牡牛和牝牛
  • 原文地址:https://www.cnblogs.com/liufeiran/p/14029490.html
Copyright © 2020-2023  润新知