'기능:?음력 달력 변환 및 음력 달력 생일
'설명: 1901-2100년에 적용 가능
'예:=lunar("2006-11 -1")? 2006년 11월 1일에 해당하는 음력을 찾으세요.
'?=solar("2006-1-1") 에서 음력 1월 1일에 해당하는 양력을 찾으세요. 2006
'?=lunarbirth("1975-5-6")?음력 생일 : 양력 1975년 5월 6일에 태어나, 올해 음력 생일에 해당하는 양력 날짜
'?=solarbirth("1975 -5-6") 그레고리력 생일 : 그레고리력으로 1975년 5월 6일 출생, 올해 양력 생일에 해당하는 양력 날짜
유형 ?ConvDataA
윤월?As?정수
월(1?To?13)?As?정수
sp_month?As?Integer?'Solar?month ?of?봄?축제
sp_day?As? Integer?'Solar?dayof?봄?축제
End?Type
개인?함수?LunarData( q_year)?As?ConvDataA
Dim?d? As?Long
Dim?Month(1?To?13)?As?Integer
'1901 -2100
LunarCal?=?Array(&H4AE53, ? &HA5748,? 44E, ?&HD6A43,?&H296D37,?&H95B4B,?&H749BC1,?&H49754,?_
&HA4B48,? &H5B25BC,?&H6A550,?&H6D445,?&H4ADAB8,?&H2B64D,?&H95742,?&H2497B 7,?&H4974A, ?&H664B3E,?_
&HD4A51,?&HEA546,?&H56D4BA,?&H5AD4E, ?&H2B644, ?&H393738,?&H92E4B,?&H7C96BF,?&HC9553,?&HD4A48,?_
&H6DA53B,?&HB554F,?&H56A45,?&H4AADB9,?&H25D4D,?&H92D42,?&H2C95B6,?&HA954A ,?&H7B4ABD, ?&H6CA51,?_
&HB5546,?&H555ABB,?&H4DA4E,?&HA5 B43,?&H352BB8,?&H52B4C,?&H8A953F,?&HE9552,?&H6AA48,?&H7AD53C,?_
&HAB54F,?&H4B645,?&H4A5739,?&HA574D,?&H52642,?&H3E9335,?&HD9549,?&H75AABE,?&H56A51,?&H96D46,?_
&H54AEBB,?&H4AD4F,?&HA4D43,? &H4D26B7,?&HD254B,?&H8D52BF,?&HB5452,?&HB6A47,?&H696D3C,?&H95B50,?_
&H49B45,?&H4A4BB9,?&HA4B4D,?&HAB25C2,?&H6A554,?&H6D44 9,?& H6ADA3D, ?&HAB651,?&H93746,?&H5497BB,?_
&H4974F,?&H64B44,?&H36A537,?&HEA54A,?&H86B2BF,?&H5AC53,?&HAB647,?&H5936BC,?&H92E50,?&HC9645,? _< / p>
&H4D4AB8,?&HD4A4C,?&HDA541,?&H25AA36,?&H56A49,?&H7AADBD,?&H25D52,?&H92D47,?&H5C95BA,?&HA954E,?_
&HB4A43,?&H4B5537,? &HAD54A ,?&H955ABF,?&H4BA53,?&HA5B48,?&H652BBC,?&H52B50,?&HA9345,?&H474AB9,?_
&H6AA4C,?&HAD541,?&H24DAB6,?&H4B64A,?&H69573D,?&HA4 E51,? &HD2646 ,?&H5E933A,?&HD534D,?&H5AA43,?_
&H36B537,?&H96D4B,?&HB4AEBF,?&H4AD53,?&HA4D48,?&H6D25BC,?&HD254F,?&HD5244,?&H5DAA38,?&HB 5A4C,? _
&H56D41,?&H24ADB6,?&H49B4A,?&H7A4BBE,?&HA4B51,?&HAA546,?&H5B52BA,?&H6D24E,?&HADA42,?&H355B37,?_
&H9374B,?&H8497C1 , ?&H49753,?&H64B48,?&H66A53C,?&HEA54F,?&H6B244,?&H4AB638,?&HAAE4C,?&H92E42,?_
&H3C9735,?&HC9649,?&H7D4ABD,?&HD4A51,?&HDA545, ?&H55AABA , ?
&H56A4E,?&HA6D43,?&H452EB7,?&H52D4B,?_
&H8A95BF,?&HA9553,?&HB4A47,?&H6B553B,?&HAD54F,?&H55A45,?&H4A5D38,?&HA5B4C,?&H52B42,? & H3A93B6, ?&H69349,?&H7729BD,?&H6AA51,?&HAD546,?&H54DABA,?&H4B64E,?&HA5743,?&H452738,?&HD264A,?&H8E933E,?_
&HD5252,? &HDAA47 ,?&H66B53B,?&H56D4F,?&H4AE45,?&H4A4EB9,?&HA4D4C,?&HD1541,?&H2D92B5,?&HD5349)
startyear?=?1901
ng?=?LunarCal (q_year?-?startyear)
d?=?&H100000
LunarData.leapmonth?=?Int(ng?/?d)
ng?= ?ng?Mod?d
d?=?&H80
mdata?=?Int(ng?/?d)
ng?=?ng? 모드 ?d
d?=?&H20
LunarData.sp_month?=?Int(ng?/?d)
LunarData.sp_day?=?ng ? Mod?d
d?=?&H1000
i?=?1
Do
LunarData.Month(i)? = ?29?+?Int(mdata?/?d)
mdata?=?mdata?Mod?d
If?d?=?1?Then?Exit?Do < /p>
d?=?d?/?2
i?=?i?+?1
루프
If?LunarData .Leapmonth?=?0?Then?LunarData.Month(i)?=?0
End?Function
Function?lunar(Solar_date?As?Date,?Optional?Part ? As?Integer?=?0)?As?String
'부분?=?0,?all;?부분?=?1,?음력?연도;?부분?=?2,? 음력 ?월;?부분?=?3,?음력?일
어두운?a?As?ConvDataA
l_year?=?연도(양력 날짜)
a?=?LunarData(l_year)
sp_date?=?DateSerial(l_year,?a.sp_month,?a.sp_day)
If?sp_date?>?Solar_date?Then < /p>
l_year?=?l_year?-?1
a?=?LunarData(l_year)
sp_date?=?DateSerial(l_year,?a.sp_month , ?a.sp
_day)
끝?If
l_day?=?Solar_date?-?sp_date
l_month?=?1
IS_lunar_leapmonth?= ?False
y?=?a.Month(l_month)
Do?While?l_day?>=?y
l_day?=?l_day?- ?y
If?l_month?=?a.leapmonth?Then?IS_lunar_leapmonth?=?(Not?IS_lunar_leapmonth)
If?IS_lunar_leapmonth?Then
y ?=?a.Month(13)
그밖에
l_month?=?l_month?+?1
y?=?a.Month(l_month)
끝?
루프
l_day?=?l_day?+?1
음력?=?l_year?&?" -"?&?l_month?&?"-"?&?l_day
If?IS_lunar_leapmonth?Then?lunar?=?lunar?&?"-L"
달? =?Choose(Part?+?1,?lunar,?l_year,?l_month,?l_day)
End?함수
Function?solar(Lunar_date,?Optional?IS_lunar_leapmonth? As?Integer?=?0)?As?String
'IS_lunar_leapmonth?=?0,?No?leap?month;?IS_lunar_leapmonth?=?1,?is?leap?month
Dim?a?As?ConvDataA
Lunar_date?=?Split(Lunar_date,?"-")
s_year?=?Lunar_date(0)
< p>For?Each?C?In?Lunar_dateIf?C?=?"L"?Then?IS_lunar_leapmonth?=?1
다음
a?=?LunarData(s_year)
sp_date?=?DateSerial(s_year,?a.sp_month,?a.sp_day)
If?Lunar_date(1)?<>? a.leapmonth?Then?IS_lunar_leapmonth?=?0
x?=?Lunar_date(2)
tm?=?Lunar_date(1)?+?IS_lunar_leapmonth?-?1< /p>
For?i?=?1?To?tm
x?=?x?+?a.Month(i)
If?i?= ?a.leapmonth?And?IS_lunar_leapmonth?=?0?Then
x?=?x?+?a.Month(13)
End?If
< p>다음s_date?=?sp_date?+?x?-?1
solar?=?s_date
End?Function
< p>Function?lunarbirth(Solar_birthday?As?Date,?선택 사항?Inquire_year?As?Integer)?As?String
If?Inquire_year?=?0?Then
Inquire_year?=?Left(음력(현재),?4 )
lunarbirth?=?solar(Inquire_year?&?Mid(lunar(Solar_birthday),?5,?10))
If?CDate(lunarbirth)?
End?If
음력탄생?=?solar(Inquire_year?&?Mid(lunar(Solar_birthday),? 5,?10))
End?함수
함수?solarbirth(Solar_birthday?As?Date,?Optional?Inquire_year?As?Integer)?As?String
If?Inquire_year?=?0?Then
Inquire_year?=?연도(현재)
solarbirth?=?DateSerial(Inquire_year,?Month(Solar_birthday),?Day (Solar_birthday))
If?CDate(solarbirth)?
End?If
solarbirth?=?DateSerial(Inquire_year,?Month(Solar_birthday),?Day(Solar_birthday))
End?함수