logo  How To find Gregorian Date for Chinese Lunar Festival
This Chapter
Date Functions
Advent
Bank Hol (UK)
Chinese Calendar
Easter
Easter-Orthodox
Epoch Dates
Hebrew Calendar
Iso-Week Calendar
Nearest Weekday
Week Of Month
Other Dates
Chapters
Home Page
Colours, RGB
Computer Specifications
Dates&Times
Disk Drives
Files
Folders
GPS and OS Ref
VB.Net Forms
Image Files
If & Select
List/Array
Mathematics
NuGet
Sound
String Functions
Sun and Moon
User Controls
Validation
DigitalDan Sites
My Other Sites
Contact Site

Note
Some pages
may contain
inaccuracies
Hits=5
Chinese Festival dates are sometimes based on the Chinese Lunar Calendar. This page provides functions for calculating the Gregorian dates of various lunar festivals. Converting lunar dates to Gregorian could involve complex mathematics, this can be avoided by using calender conversion routines buit into the .NET framework. (They are part of all recent releases of VB.Net and will not need any external packages or additional references.)
 
The following comments indicate some potential problems linked to lunar-Gregorian date conversions
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