• _056_根据年份判断十二生肖


    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Forms;
    
    namespace _056_根据年份判断十二生肖
    {
        class Program
        {
            static void Main(string[] args)
            {
                System.Globalization.ChineseLunisolarCalendar chineseCaleander =new System.Globalization.ChineseLunisolarCalendar();
                string TreeYear = "鸡狗猪鼠牛虎兔龙蛇马羊猴";
                //string TreeYear = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
                //int intYear = chineseCaleander.GetSexagenaryYear(DateTime.Now);
                int intYear = DateTime.Now.Year % 12;
                //intYear = 12;
                string Tree = TreeYear.Substring(chineseCaleander.GetTerrestrialBranch(intYear) - 1, 1);
                //利用IsLeapYear()判断本年度是不是闰年
                bool P_b1 = DateTime.IsLeapYear(int.Parse(DateTime.Now.ToString("yyyy")));
                if (P_b1)
                    Console.WriteLine("半年都是闰年");
                else
                    Console.WriteLine("本年度是平年");
                //利用DaysInMonth()方法找出本月的天数;
                Console.WriteLine("本月的天数为{0}天。", DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));
                //显示今天是星期几
                Console.WriteLine(DateTime.Now.ToString("dddd"));
                
                Console.WriteLine("今年是十二生肖" + Tree + "");
                MessageBox.Show("今年是十二生肖" + Tree + "", "判断十二生肖", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Console.ReadKey();
            }
        }
    }
  • 相关阅读:
    创建自定义 AJAX 客户端控件(msdn)
    使用jquery的blockui插件显示弹出层
    Sql Server高手必备
    Js获取当前日期时间及其它操作
    在VS2010中创建自定义的代码段
    存储过程分页
    完美辨析各种高度区别
    程序员必备的正则表达式
    Sql日期格式化
    C#调用Quartz实例代码
  • 原文地址:https://www.cnblogs.com/yuanshou/p/10660524.html
Copyright © 2020-2023  润新知