C#(065):中文日历Calendar(C# (065): Chinese 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();//;五
————————

1、 Hierarchy

Object<—–Calendar<—–EastAsianLunisolarCalendar<—–ChineseLunisolarCalendar(农历)

2、 Usage

1. Maximum and minimum dates supported

$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();//;五