zoukankan      html  css  js  c++  java
  • c# 算节气

        public static string ChineseTwentyFourDay(DateTime date1)
        {
            string[] SolarTerm = new string[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" };
            int[] sTermInfo = new int[] { 0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758 };
            DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
            DateTime newDate;
            double num;
            int y;
            string tempStr = "";
    
            y = date1.Year;
    
            for (int i = 1; i <= 24; i++)
            {
                num = 525948.76 * (y - 1900) + sTermInfo[i - 1];
    
                newDate = baseDateAndTime.AddMinutes(num);//按分钟计算
                if (newDate.DayOfYear == date1.DayOfYear)
                {
                    tempStr = SolarTerm[i - 1];
                    break;
                }
            }
            return tempStr;
        }
    
    
    
    
    
    protected void Page_Load(object sender, EventArgs e)
        {
            DateTime dt = new DateTime(2013, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM#
            string jq = ChineseTwentyFourDay(dt);
            Response.Write("节气:" + jq);
        }
    
  • 相关阅读:
    使用Link Shell Extension方便的创建同步文件
    DOM案例【3】密码强度检查案例
    DOM案例【2】注册文本倒计时
    DOM案例【1】文本时钟
    HTML5 and CSS【01】Font
    常用单词
    CSS基础【01】类和ID选择器的区别
    【03】Html重点
    【02】Html(如鹏)
    C#MD5计算代码
  • 原文地址:https://www.cnblogs.com/weloglog888/p/2869488.html
Copyright © 2011-2022 走看看