Introduction

This is an implementation of Am lich VN (http://www.informatik.uni-leipzig.de/~duc/amlich/) in C# / .NET 2.0. It's useful to calculate the Vietnamese lunar date in a .NET application (and I hope this source code may be used as a build-in for the Microsoft .NET Framework).

Background

This article uses the algorithm of author Ho Ngoc Duc (http://www.informatik.uni-leipzig.de/~duc/) to make a VietnameseCalendar class (it's similar to the ChineseLunarCalendar class - a build-in of Microsoft .NET 2.0).

Using the Code

You may use this class to convert a solar date (Gregorian calendar) to a Vietnamese lunar date and vice versa.

* You can use this class to get VN lunar start hour of a day; or get Minor solar terms; Propitious hours in a day,...

* A Vietnam lunar month can be 1 to 13 (because of leap-month) as a numeric. Example: VN Lunar year 1979 has leap-month: 6 So this year has 13 months (from 1 to 13, as an int) like:[1], [2] ... [5], [6], [7 => 6(N)], [8 (=> 7)], [9] ... [13] So, if you convert 1979-9-17, you will received 1979/8/26 as output numbers, but string will be "26, Tháng Bảy, Năm Kỷ Mùi" (if you use the method: GetMonthSpeechName(y, m))

Points of Interest

This class has been tested by unit-testing (in the attached file). Here is that class diagram:

VN Lunar year 1979 has leap-month: 6So this year has 13 months (from 1 to 13, as an int) like:[1], [2] ... [5], [6], [7 => 6(N)], [8 (=> 7)], [9] ... [13]Your checked month 7 is greater than the leap-month, so, it will be returned as 8