• js 处理日期


    var CountTime = 2 * 60 * 1000;
    var Countdown = CountTime;
    
    function RefreshTime() {
        var dataObj = new Date();
        dataObj.setTime(Countdown);
        $("#jsCountTime").html(dataObj.getMinutes() + "分钟" + dataObj.getSeconds() + "");
        Countdown = Countdown - 1000;
        if (Countdown <= 0) {
            if ($("#jsLastStatus").val() != GetDateString()) {
                MonitorAjax();
            }
            Countdown = CountTime;
            $("#jsLastStatus").val(GetDateString());
        }
    
        window.setTimeout(function () {
            RefreshTime();
        }, 1000);
    }
    function GetDateString() {
        var dateTime = new Date();
        var year = dateTime.getYear(); //获取当前年份(2位)  
        var moonth = dateTime.getMonth(); //获取当前月份(0-11,0代表1月)  
        var day = dateTime.getDay(); //获取当前星期X(0-6,0代表星期天)
        var hour = dateTime.getHours();
        return year + "" + moonth + "" + day + "" + hour;
    }
    function NowTime() {
        var nowDate = new Date();
        var week;
        if (new Date().getDay() == 0) week = "星期日"
        if (new Date().getDay() == 1) week = "星期一"
        if (new Date().getDay() == 2) week = "星期二"
        if (new Date().getDay() == 3) week = "星期三"
        if (new Date().getDay() == 4) week = "星期四"
        if (new Date().getDay() == 5) week = "星期五"
        if (new Date().getDay() == 6) week = "星期六"
        var Nowtime = nowDate.getFullYear() + "-" + (nowDate.getMonth()+1) + "-" + nowDate.getDate() + "&nbsp;&nbsp; " + week;
        $("#jsnowtime").html(Nowtime);
    }
    function numToArr(num)
    {
        var result = [];
        var num1 = num;
        while (num1 / 10 >= 1)
        {
            result.push(num1 % 10); num1 = parseInt(num1 / 10);
        }
        result.push(num1 % 10);
        for (var i = result.length; i < 4; i++) {
            result.push(0);
        }
        return result;
    }
  • 相关阅读:
    解决“此计算机上已安装了试用版。必须先卸载以前安装的试用版后才能安装另一个试用版。”
    Windows 7 快捷键
    【译】部署Asp.Net MVC 网站到Winodws Azure
    jqGrid专题:搜索
    jqGrid专题:格式化数据
    jqGrid专题:事件文档
    jqGrid专题:方法文档
    jqGrid专题:数据加载
    jqGrid专题:参数文档
    jqGrid专题:jqGrid原理
  • 原文地址:https://www.cnblogs.com/futengsheng/p/7001828.html
Copyright © 2020-2023  润新知