개발 이야기/Visual C#
System.Globalization 음력구하기
사나에
2008. 7. 2. 10:36
System.Globalization 네임스페이스에는 KoreanCalendar 클래스를 제공해준다.
윤년의 정의 : 4로 나누어 떨어지되~ 100의 배수인 연도는 윤년에서 제외한다. 단, 400의 배수인 연도는 무조건 윤년이다.
평년의 날짜 수는 365일이고, 윤년의 날짜 수는 366일입니다.
한국식 달력의 월 수는 12개월이며, 각 월의 날짜 수는 28일에서 31일 사이입니다.
GetMonth 값 | 월 | 평년의 날짜 수 | 윤년의 날짜 수 |
1 | 1월 (January) | 31 | 31 |
2 | 2월 (February) | 28 | 29 |
3 | 3월 (March) | 31 | 31 |
4 | 4월 (April) | 30 | 30 |
5 | 5월 (May) | 31 | 31 |
6 | 6월 (June) | 30 | 30 |
7 | 7월 (July) | 31 | 31 |
8 | 8월 (August) | 31 | 31 |
9 | 9월 (September) | 30 | 30 |
10 | 10월 (October) | 31 | 31 |
11 | 11월 (November) | 30 | 30 |
12 | 12월 (December) | 31 | 31 |
[C# Code]
System.Globalization.KoreanLunisolarCalendar KoreanLunisolar = new System.Globalization.KoreanLunisolarCalendar();
DateTime BirthLift = new DateTime(1983, 05, 03);
DateTime BirthLunar = new DateTime(KoreanLunisolar.GetYear(BirthLift), KoreanLunisolar.GetMonth(BirthLift), KoreanLunisolar.GetDayOfMonth(BirthLift));