# 万年历 **Repository Path**: xkdong/ChineseCalendar ## Basic Information - **Project Name**: 万年历 - **Description**: 一个由C#编写的万年历插件 - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2019-02-13 - **Last Updated**: 2024-09-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 万年历 #### 介绍 一个由C#编写的万年历插件 #### 使用说明 1. 源码转自https://blog.csdn.net/zdrl/article/details/12151897 2. 引用方法如下 ```` using System; using Perpetual_Calendar; namespace ConsoleApp1 { class Program { static void Main(string[] args) { DateTime dt = DateTime.Now; ChineseCalendar cc = new ChineseCalendar(dt); Console.WriteLine("公历:" + cc.DateString); Console.WriteLine("农历:" + cc.ChineseDateString); Console.WriteLine("本年属相:" + cc.AnimalString); Console.WriteLine("时辰:" + cc.ChineseHour); if (cc.ChineseTwentyFourDay != "") { Console.WriteLine("节气:" + cc.ChineseTwentyFourDay); } if (cc.DateHoliday != "") { Console.WriteLine("节日:" + cc.DateHoliday); } Console.WriteLine("前一个节气:" + cc.ChineseTwentyFourPrevDay); Console.WriteLine("后一个节气:" + cc.ChineseTwentyFourNextDay); Console.WriteLine("干支:" + cc.GanZhiDateString); Console.WriteLine("星期:" + cc.WeekDayStr); Console.WriteLine("星宿:" + cc.ChineseConstellation); Console.WriteLine("星座:" + cc.Constellation); Console.ReadKey(); } } } ```