编程语言
首页 > 编程语言> > C#(065):中文日历Calendar

C#(065):中文日历Calendar

作者:互联网

一、层次结构

Object<-----Calendar<-----EastAsianLunisolarCalendar<-----ChineseLunisolarCalendar(农历)

二、用法

1、支持的最大,最小日期

$1```
    s2=cc.MaxSupportedDateTime.ToString("");//01/28/2101 23:59:59
```csharp
$1```

```csharp
$1```
    
```csharp
$1```
    
```csharp
$1```
    s3=cc.GetDayOfMonth(DateTime.Now).ToString();//;23
```csharp
$1```

    System.Globalization.ChineseLunisolarCalendar cc = new System.Globalization.ChineseLunisolarCalendar();

    int currentMonth = cc.GetMonth(DateTime.Today);

    int leapMonth = cc.GetLeapMonth(DateTime.Today.Year);

    string realMonth;

    if (currentMonth < leapMonth)

        realMonth = monthName[currentMonth];

    else if (currentMonth == leapMonth)

        realMonth = "闰" + monthName[currentMonth - 1];

    else

        realMonth = monthName[currentMonth - 1];

    s1 = realMonth.ToString();//;五

标签:065,C#,DateTime,cc,monthName,csharp,Calendar,currentMonth,realMonth
来源: https://www.cnblogs.com/springsnow/p/16272334.html