zoukankan      html  css  js  c++  java
  • 时间js

    function Appendzero (obj) {
        if (obj < 10) return "0" + obj; else return obj;
    }
    function getWeek () {
       var weeknum = new Date().getDay ();
       var week = "";
       if (weeknum == 0)  week = "星期日";
       if (weeknum == 1)  week = "星期一";
       if (weeknum == 2)  week = "星期二";
       if (weeknum == 3)  week = "星期三";
       if (weeknum == 4)  week = "星期四";
       if (weeknum == 5)  week = "星期五";
       if (weeknum == 6)  week = "星期六";
       return week;
    }
    function getDate(){
       var now = new Date ();
       var year = now.getFullYear ();//获取四位数年数
       var month = now.getMonth () + 1;
       var date = now.getDate ();
       var s = year + "-" + Appendzero (month) + "-" + Appendzero (date) 
       return s;
    }
    function getTime(){
        var now = new Date ();
        var hour = now.getHours ();
        var minute = now.getMinutes ();
        var second = now.getSeconds ();
        var s = Appendzero (hour) + ":" + Appendzero (minute) + ":" + Appendzero (second);
        return s;
    }
    function getTime2(){
        var now = new Date ();
        var hour = now.getHours ();
        var minute = now.getMinutes ();
        var s = Appendzero (hour) + ":" + Appendzero (minute)
        return s;
    }
    //设置动态时间
    function setTime1(id){
          document.getElementById("id").innerHTML = getTime2();
         window.setTimeout("setTime("+id+")", 1000);
    }
    //设置动态时间
    function setTime2(id){
          document.getElementById("id").innerHTML = getTime1();
         window.setTimeout("setTime("+id+")", 1000);
    }
  • 相关阅读:
    领域驱动设计(DomainDriven Design)
    Windows服务相关文档
    Attributes概述
    异步调用WebService方式!
    Msdn 杂志 asp.net ajax 文章汇集
    JavaScript
    常用数组效率比较
    Windows服务
    SOA实战
    Nunit使用方法
  • 原文地址:https://www.cnblogs.com/beimingbingpo/p/8780799.html
Copyright © 2011-2022 走看看