• 判断年月日的方法


    1. 

    2. 

    3. 

     1     protected string getChangeDay(string month,int  year)
     2     {
     3         if ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))
     4         {
     5             return "31";
     6         }
     7         else if (month == "02")
     8         {
     9             if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
    10             {
    11                 return "28";
    12             }
    13             else { return "29"; }
    14         }
    15         else
    16         {
    17             return "30";
    18         }
    19     }
    20     protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
    21     {
    22         getChage();
    23     }
    24 
    25     private void getChage()
    26     { 
    28         txtCreator.Value = string.Empty;
    29         string year = ddlYear.SelectedValue;
    30         string month = ddlMonth.SelectedValue;
    31         if (!string.IsNullOrEmpty(year))
    32         {
    33             txtStartDate.Text = year + "-" + month + "-" + "01";
    34             txtEndDate.Text = year + "-" + month + "-" + getChangeDay(month, Convert.ToInt32(year));
    35         }       
    37     }
    38     protected void ddlMonth_SelectedIndexChanged(object sender, EventArgs e)
    39     {
    40         getChage();
    41     }
  • 相关阅读:
    线段树区间最大子段和
    NTT数论变换
    cdq分治·三维偏序问题
    线段树区间开方
    怎么联系$zcy$呢?
    题解 CF375D 【Tree and Queries】
    点分治模板
    Good Bye 2018题解
    Hello 2019题解
    Codeforces Round #525 (Div. 2)题解
  • 原文地址:https://www.cnblogs.com/MarkTang/p/3988498.html
Copyright © 2020-2023  润新知