The following comments indicate some potential problems linked to lunar-Gregorian date conversions
- The number of days in a Lunar year can vary between 353 and 385 days. (The Gregorian Calendar only varies between 365 and 366 days.)
- The first day of the lunar calendar can fall anywhere in the Gregorian period of 21 January to 20 February
- Normally, a gregorian year will have a single date matching a chinese festival.
- Occassionally, a single Gregorian Year will contain the same festival from 2 successive Lunar years (when festival lands each side of 1 Jan). You can also get Gregorian years where a specified festival does not occur.
- The Lunar calendar uses "Leap Months" to remain "approximately" aligned with a solar year. Any of the 12 "normal" lunar months can be repeated before starting the next lunar month
- The "Leap Month" will only occur in Lunar leap years. The repeated month could be any of the 12 normal months and will create a 13 month year.
- Converting dates within the original and repeated month of a leap year may require additional knowledge. (Do you use original month or the repeated leap-month?)
- The Lunar .NET calendar conversion feature is only valid for the lunar years 1901 to 2100.
- Geographic location, local time and cultural differences affect Calendrical Calculations. These functions are based on Beijing time/location.
Get Gregorian Date relating to Chinese Lunar Calendar Date
Private Function ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, mm_Chin As Integer, dd_Chin As Integer) As Date
' When a lunar event falls in the repeated month of a leap year, we normally celebrate in 1st occurence of month
Dim chinese As New Globalization.ChineseLunisolarCalendar
Dim gregorian As New Globalization.GregorianCalendar
Dim leapMonth As Integer
Dim LeapAdjustedMonth As Integer
Dim dat_Chin, dat_Greg As Date
leapMonth = chinese.GetLeapMonth(yyyy_Chin)
If leapMonth > 0 AndAlso leapMonth <= mm_Chin Then
LeapAdjustedMonth = mm_Chin + 1
Else
LeapAdjustedMonth = mm_Chin
End If
dat_Chin = chinese.ToDateTime(yyyy_Chin, LeapAdjustedMonth, dd_Chin, 12, 0, 0, 0)
' using midday to avoid risk of clock adjustmenst etc. changing dates
dat_Greg = New Date(gregorian.GetYear(dat_Chin), gregorian.GetMonth(dat_Chin), gregorian.GetDayOfMonth(dat_Chin), 12, 0, 0, 0)
Return dat_Greg
End Function
Calculating Specific Lunar Event Dates
Dim yyyy_Chin as integer
' yyyy_Chin should be year in the Chinese calendar. Typucally either year_Gregoraian or (year_Gregorian - 1)
Dim ChineseNewYear As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 1, 1)
Dim LanternFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 1, 15)
Dim Zhonghe Festival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 2, 2)
Dim ShangsiFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 3, 3)
Dim DuanwuFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 5, 5)
Dim QixiFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 7, 7)
Dim GhostFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 7, 15)
Dim MidAutumnFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 8, 15)
Dim DoubleNinthFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 9, 9)
Dim SpringFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 10, 15)
Dim LabasFestival As Date = ChineseEventDate_To_GregorianDate(yyyy_Chin As Integer, 12, 8)
DigitalDan.co.uk