zoukankan      html  css  js  c++  java
  • 获取月份对应的day

    1    function getDaysInMonth(month, year) {
    2         var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];      //主要处理二月份的天数  
    3         if ((month == 1) && (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) {
    4             return 29;
    5         } else {
    6             return daysInMonth[month];
    7         }
    8     }

    // 闰年的判定方法
      判定公历闰年遵循的规律为: 四年一闰,百年不闰,四百年再闰.
       公历闰年的简单计算方法:(符合以下条件之一的年份即为闰年)
       1.能被4整除而不能被100整除。(如2100年就不是闰年)
       2.能被400整除。(如2000年是闰年)
  • 相关阅读:
    常用基础命令
    Vim
    Linux目录结构
    稀疏数组
    数据结构概述
    天天用的命令
    Mysql和redis的安装
    回文排列
    URL化
    在word中做复选框打对勾钩
  • 原文地址:https://www.cnblogs.com/mushishi/p/3161959.html
Copyright © 2011-2022 走看看