YZ.Calendar
1.3.3
dotnet add package YZ.Calendar --version 1.3.3
NuGet\Install-Package YZ.Calendar -Version 1.3.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YZ.Calendar" Version="1.3.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YZ.Calendar --version 1.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: YZ.Calendar, 1.3.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YZ.Calendar as a Cake Addin
#addin nuget:?package=YZ.Calendar&version=1.3.3
// Install YZ.Calendar as a Cake Tool
#tool nuget:?package=YZ.Calendar&version=1.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
万年历农历阳历转换插件 YZ.Calendar
- A plugin that can convert Chinese lunar and solar calendars.
- 一个能转换中国农历和阳历的插件。
using YZ.Calendar
/// <summary>
/// 设置节假日的json文件地址,推荐绝对路径,优先设置。
/// 不填返回null
/// </summary>
CalendarSystem.SetFastivalPath
/// <summary>
/// 设置休息日与调休日的json文件地址,推荐绝对路径,优先设置。
/// 不填返回false
/// </summary>
CalendarSystem.SetRestPath
//阳历转农历,阳历年月日
CalendarYZ result2 = CalendarSystem.SolarToLunarFun(int year, int month, int day);
//阳历转农历,农历年月日,isLeapMonth表示是否润月,默认为false
CalendarYZ result2 = CalendarSystem.LunartoSolarFun(int LYear, int LMonth, int LDay, bool isLeapMonth);
节日格式 json
{
"sFtv": {
"1001": [
"国庆节",
"国际音乐日",
"世界微笑日",
"国际老人节"
],
},
"lFtv":{
"0101": [
"春节"
]
}
}
休息日与调休日 json
{
"2020": {
"xiu": ["0101","0124","0125"],
"ban": [ "0119","0201","0426"]
},
"2021":{
"xiu": ["0101","0124","0125"],
"ban": [ "0119","0201","0426"]
}
}
其他方法
- 阳历的方法
/// <summary>
/// 返回公历(!)y年m月的天数
/// </summary>
/// <returns>(28、29、30、31)</returns>
SolarFunction.SolarDays(int year,int month)
/// <summary>
/// 返回公历(!)y年m月的第一天是星期几
/// </summary>
/// <returns>(1-7)</returns>
SolarFunction.SolarFirstWeek(int year,int month)
/// <summary>
/// 公历月、日判断所属星座
/// </summary>
/// <returns>十二星座</returns>
SolarFunction.ToAstro(int month,int day)
/// <summary>
/// 传入公历(!)y年获得该年第n个节气的公历日期
/// </summary>
/// <returns>该月的day</returns>
SolarFunction.GetTerm(int year,int month)
/// <summary>
/// 年份转生肖[!仅能大致转换] 精确划分生肖分界线是“立春”
/// </summary>
/// <returns>"鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"</returns>
SolarFunction.GetAnimal(int year)
/// <summary>
/// 数字转中文(1-10)0表示日
/// </summary>
/// <returns>'日','一','二','三','四','五','六','七','八','九','十'</returns>
SolarFunction.ToChinaNum(int num)
- 农历方法
/// <summary>
/// 返回农历y年一整年的总天数
/// </summary>
/// <returns>一整年的总天数</returns>
LunarFunction. LYearDays(int year)
/// <summary>
/// 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
/// </summary>
/// <returns>(0-12)</returns>
LunarFunction.LeapMonth(int year)
/// <summary>
/// 返回农历y年闰月的天数 若该年没有闰月则返回0
/// </summary>
/// <returns>(0、29、30)</returns>
LunarFunction.LeapDays(int year)
/// <summary>
/// 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
/// </summary>
/// <returns>(29、30)</returns>
LunarFunction.LMonthDays(int year,int month)
/// <summary>
/// 传入农历数字月份返回汉语通俗表示法(1-12)
/// </summary>
/// <returns>'正','二','三','四','五','六','七','八','九','十','冬','腊'</returns>
LunarFunction.ToChinaMonth(int month)
/// <summary>
/// 传入农历日期数字返回汉字表示法
/// </summary>
/// <returns>汉字中文日期:初一,初十','廿','卅'</returns>
LunarFunction.ToChinaDay(int day)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.