//양력은 음력으로변환 테스트
private void button1_Click(object sender, EventArgs e)
{
	label1.Text =음력변환(2007, 1, 1);
	label2.Text = 음력변환(DateTime.Now);
}
 
//음력을 양력으로 변환 테스트
private void button2_Click(object sender, EventArgs e)
{
	label2.Text = 양력변환(2006,11,13,false).ToShortDateString();
}
 
private string 음력변환(DateTime dt)
{
	int n윤월;
	int n음력년, n음력월, n음력일;
	bool b윤달 = false;
	System.Globalization.KoreanLunisolarCalendar 음력 = 
	new System.Globalization.KoreanLunisolarCalendar();
 
	n음력년 = 음력.GetYear(dt);
	n음력월 = 음력.GetMonth(dt);
	n음력일 = 음력.GetDayOfMonth(dt);
	if (음력.GetMonthsInYear(n음력년) > 12)             //1년이 12이상이면 윤달이 있음..
	{
		b윤달 = 음력.IsLeapMonth(n음력년, n음력월);     //윤월인지
		n윤월 = 음력.GetLeapMonth(n음력년);             //년도의 윤달이 몇월인지?
		if (n음력월 >= n윤월)                           //달이 윤월보다 같거나 크면 -1을 함 즉 윤8은->9 이기때문
		n음력월--;
	}
	return n음력년.ToString() + "-" + (b윤달 ? "*" : "") + n음력월.ToString() + "-" + n음력일.ToString();
}
 
private string 음력변환(int n양력년, int n양력월, int n양력일)
{
	DateTime dTemp = new DateTime(n양력년, n양력월, n양력일); //양력
	return 음력변환(dTemp);
}
 
private DateTime 양력변환(int n음력년, int n음력월, int n음력일, bool b달)
{
	int n윤월; 
	System.Globalization.KoreanLunisolarCalendar 음력 = 
	new System.Globalization.KoreanLunisolarCalendar();
	if (음력.GetMonthsInYear(n음력년) > 12)
	{
		n윤월 = 음력.GetLeapMonth(n음력년);
		if (b달)
			n음력월++;
		if (n음력월 > n윤월)
			n음력월++;
	}
	return 음력.ToDateTime(n음력년, n음력월, n음력일, 0, 0, 0, 0);
}