Q&A

  • 음력생년월일을 가지고 현재의 양력년월일을 구할 수 있나요?
안녕하세요.

일반적으로 그냥 음력년월일을 가지고,
양력년월일을 구하는 방법은 있는데...

본인의 음력생년월일을 가지고,
올해 몇월몇일인지를 아는방법 좀 부탁드립니다.

그럼 좋은 하루되십시요...
1  COMMENTS
  • Profile
    조규춘 2002.01.19 00:43



    질문하신거에 대해서 팁을 찾아 보셨도 될텐데요..

    대신 올립니다.

    unit SolarLunar;

    interface


    Procedure Solar_To_Lunar(Year,Month,Day:Word; Var LYear,LMonth,LDay : Word);
    Procedure Lunar_To_Solar(LunarYear,LunarMonth,LunarDay : Word;
    Var SolarYear,SolarMonth,SolarDay : Word);

    implementation

    Procedure Solar_To_Lunar(Year,Month,Day:Word; Var LYear,LMonth,LDay: Word);
    Const
    kk : array [0..162,0..12] of 0..4 = (
    {*1881*} ( 1, 2, 1, 2, 1, 2, 2, 3, 2, 2, 1, 2, 1 ) ,
    ( 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0 ) ,
    ( 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 0 ) ,
    ( 2, 1, 1, 2, 1, 3, 2, 1, 2, 2, 1, 2, 2 ) ,
    ( 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 0 ) ,
    ( 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0 ) ,
    ( 2, 2, 1, 2, 3, 2, 1, 1, 2, 1, 2, 1, 2 ) ,
    ( 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 0 ) ,
    ( 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0 ) ,
    ( 1, 2, 3, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2 ) ,

    {*1891*} ( 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0 ) ,
    ( 1, 1, 2, 1, 1, 2, 3, 2, 2, 1, 2, 2, 2 ) ,
    ( 1, 1, 2, 1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) );

    Var
    m : Array [0..11] of Integer;
    dt : Array [0..162] of Integer;
    m1, m2, i, j, jcount : Integer;
    td, td0, td1, td2, k11 : LongInt;
    leap : Boolean;

    Begin
    m[0] := 31; m[1] := 0; m[2] := 31; m[3] := 30;
    m[4] := 31; m[5] := 30; m[6] := 31; m[7] := 31;
    m[8] := 30; m[9] := 31; m[10] := 30; m[11] := 31;

    for i:=0 To 162 Do Begin
    dt[i] := 0;
    for j:=0 To 11 Do Begin
    Case (kk[i][j]) of
    1 , 3 : dt[i] := dt[i] + 29;
    2 , 4 : dt[i] := dt[i] + 30;
    End;
    End;
    Case (kk[i][12]) of
    1 , 3 : dt[i] := dt[i] + 29;
    2 , 4 : dt[i] := dt[i] + 30;
    End;
    End;
    {* 1. 1. 1. - 1910. 2. 10. *}
    td1 := 1880*365 + (1880 Div 4)- (1880 Div 100) + (1880 Div 400) + 30;

    {* ## 1. 1. 1. - Year. Month. Day. ## *}
    k11 := (Year-1);
    td2 := k11*365 + (k11 Div 4) - (k11 Div 100) + (k11 Div 400);
    leap := ((Year mod 400) = 0) Or ((Year mod 100) <> 0) And ((Year mod 4) = 0);
    if leap then m[1] := 29
    else m[1] := 28;
    for i:=0 To Month-2 Do td2 := td2 + m[i];
    td2 := td2 + Day;

    {* ## 1881. 1. 30. - Year. Month. Day. ## *}
    td := td2 - td1 + 1;

    {* ## Lunar Year Caculation ## *}
    td0 := dt[0];
    for i:=0 To 162 Do Begin
    if( td <= td0 ) then break;
    td0 := td0 + dt[i+1];
    End;
    LYear := i + 1881;
    td0 := td0 - dt[i];
    td := td - td0;
    if(kk[i][12] <> 0) then jcount := 13
    else jcount := 12;
    m2 := 0;
    for j:=0 To jcount-1 Do Begin
    if( kk[i][j] <=2 ) then m2 := m2 + 1;
    if( kk[i][j] <=2 ) then m1 := kk[i][j] + 28
    else m1 := kk[i][j] + 26;
    if( td <= m1 ) then break;
    td := td - m1;
    End;
    LMonth := m2;
    LDay := td;
    End;


    Procedure Lunar_To_Solar(LunarYear,LunarMonth,LunarDay : Word;
    Var SolarYear,SolarMonth,SolarDay : Word);
    Const
    kk : array [1..163,1..13] of 0..4 = (

    {*1881*} (1, 2, 1, 2, 1, 2, 2, 3, 2, 2, 1, 2, 1),
    (1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0),
    (1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 0),
    (2, 1, 1, 2, 1, 3, 2, 1, 2, 2, 1, 2, 2),
    (2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 0),
    (2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (2, 2, 1, 2, 3, 2, 1, 1, 2, 1, 2, 1, 2),
    (2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 0),
    (2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 3, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2),

    {*1891*} (1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0),
    (1, 1, 2, 1, 1, 2, 3, 2, 2, 1, 2, 2, 2),
    (1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 0),
    (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 0),
    (2, 1, 2, 1, 2, 3, 1, 2, 1, 2, 1, 2, 1),
    (2, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 2, 3, 2, 2, 1, 2, 1, 2, 1, 2, 1),
    (2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 0),
    (1, 2, 1, 1, 2, 1, 2, 2, 3, 2, 2, 1, 2),

    {*1901*} (1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 0),
    (2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 0),
    (1, 2, 1, 2, 1, 3, 2, 1, 1, 2, 2, 1, 2),
    (2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 0),
    (2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 4, 1, 2, 1, 2, 1, 2, 1, 2),
    (1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 0),
    (1, 2, 3, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2),
    (1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 0),

    {*1911*} (2, 1, 2, 1, 1, 2, 3, 1, 2, 2, 1, 2, 2),
    (2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 0),
    (2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 0),
    (2, 2, 1, 2, 2, 3, 1, 2, 1, 2, 1, 1, 2),
    (2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 3, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1),
    (2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 0),
    (1, 2, 1, 1, 2, 1, 2, 3, 2, 2, 1, 2, 2),
    (1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 0),

    {*1921*} (2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 0),
    (2, 1, 2, 2, 1, 3, 2, 1, 1, 2, 1, 2, 2),
    (1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 0),
    (2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 0),
    (2, 1, 2, 2, 3, 2, 1, 2, 2, 1, 2, 1, 2),
    (1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 0),
    (2, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0),
    (1, 2, 3, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2),
    (1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 0),
    (1, 2, 2, 1, 1, 2, 3, 1, 2, 1, 2, 2, 1),

    {*1931*} (2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 0),
    (2, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 2, 4, 1, 2, 1, 2, 1, 1, 2),
    (1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 0),
    (1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 0),
    (2, 1, 1, 4, 1, 2, 1, 2, 1, 2, 2, 2, 1),
    (2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 0),
    (2, 2, 1, 1, 2, 1, 1, 4, 1, 2, 2, 1, 2),
    (2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 0),

    {*1941*} (2, 2, 1, 2, 2, 1, 4, 1, 1, 2, 1, 2, 1),
    (2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 0),
    (1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 0),
    (1, 1, 2, 1, 4, 1, 2, 1, 2, 2, 1, 2, 2),
    (1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 0),
    (2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 0),
    (2, 2, 3, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2),
    (2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (2, 2, 1, 2, 1, 2, 1, 3, 2, 1, 2, 1, 2),
    (2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 0),

    {*1951*} (2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 1, 2, 1, 4, 2, 1, 2, 1, 2, 1, 2),
    (1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 0),
    (1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 0),
    (2, 1, 1, 4, 1, 1, 2, 1, 2, 1, 2, 2, 2),
    (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 0),
    (2, 1, 2, 1, 2, 1, 1, 2, 3, 2, 1, 2, 2),
    (1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 2, 1, 2, 2, 3, 2, 1, 2, 1, 2, 1),

    {*1961*} (2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 0),
    (1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 0),
    (2, 1, 2, 1, 3, 2, 1, 2, 1, 2, 2, 2, 1),
    (2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 0),
    (1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 0),
    (2, 2, 2, 3, 2, 1, 1, 2, 1, 1, 2, 2, 1),
    (2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2),
    (1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 0),

    {*1971*} (1, 2, 1, 1, 2, 3, 2, 1, 2, 2, 2, 1, 2),
    (1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 0),
    (2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 0),
    (2, 2, 1, 2, 3, 1, 2, 1, 1, 2, 2, 1, 2),
    (2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 0),
    (2, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 1, 2),
    (2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 0),
    (2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 1, 2, 1, 2, 4, 1, 2, 2, 1, 2, 1),
    (2, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0),

    {*1981*} (1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 0),
    (2, 1, 2, 1, 3, 2, 1, 1, 2, 2, 1, 2, 2),
    (2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 0),
    (2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 3, 2, 2),
    (1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 1, 0),
    (2, 1, 2, 2, 1, 2, 3, 2, 2, 1, 2, 1, 2),
    (1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 0),
    (2, 1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 0),
    (1, 2, 1, 1, 2, 3, 1, 2, 1, 2, 2, 2, 2),

    {*1991*} (1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 0),
    (1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 0),
    (1, 2, 2, 3, 2, 1, 2, 1, 1, 2, 1, 2, 1),
    (2, 2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 0),
    (1, 2, 2, 1, 2, 2, 1, 2, 3, 2, 1, 1, 2),
    (1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 0),
    (1, 1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 0),
    (2, 1, 1, 2, 1, 3, 2, 2, 1, 2, 2, 2, 1),
    (2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 0),
    (2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 0),

    {*2001*} (2, 2, 2, 1, 3, 2, 1, 1, 2, 1, 2, 1, 2),
    (2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 0),
    (2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 0),
    (1, 2, 3, 2, 2, 1, 2, 1, 2, 2, 1, 1, 2),
    (1, 2, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 0),
    (1, 1, 2, 1, 2, 1, 2, 3, 2, 2, 1, 2, 2),
    (1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 0),
    (2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 0),
    (2, 2, 1, 1, 2, 3, 1, 2, 1, 2, 1, 2, 2),
    (2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),

    {*2011*} (2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 1, 0),
    (2, 1, 2, 4, 2, 1, 2, 1, 1, 2, 1, 2, 1),
    (2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 1, 2, 1, 2, 1, 2, 2, 3, 2, 1, 2),
    (1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 2, 2, 0),
    (1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 0),
    (2, 1, 1, 2, 1, 3, 2, 1, 2, 1, 2, 2, 2),
    (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 0),
    (2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 0),
    (2, 1, 2, 2, 3, 2, 1, 1, 2, 1, 2, 1, 2),

    {*2021*} (1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 0),
    (2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 0),
    (1, 2, 3, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2),
    (1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 0),
    (2, 1, 2, 1, 1, 2, 3, 2, 1, 2, 2, 2, 1),
    (2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 0),
    (1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 0),
    (1, 2, 2, 1, 2, 3, 1, 2, 1, 1, 2, 2, 1),
    (2, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 2, 0),
    (1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 0),

    {*2031*} (2, 1, 2, 3, 2, 1, 2, 2, 1, 2, 1, 2, 1),
    (2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 0),
    (1, 2, 1, 1, 2, 1, 2, 3, 2, 2, 2, 1, 2),
    (1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 0),
    (2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 0),
    (2, 2, 1, 2, 1, 1, 4, 1, 1, 2, 1, 2, 2),
    (2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 0),
    (2, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 0),
    (2, 2, 1, 2, 2, 3, 2, 1, 2, 1, 2, 1, 1),
    (2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 0),

    {*2041*} (2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2, 0),
    (1, 2, 3, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2),
    (1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 0)
    );

    YukGabHeaven : array[1..10] of string =
    ( 'GAP', 'EUL', 'BYEONG', 'JEONG', 'MOO',
    'GEE', 'GYEONG', 'SIN', 'EEM', 'GYE' );
    YukGabEarth : array[1..12] of string =
    ( 'JAH', 'CHOOK', 'EEN', 'MYO', 'JIN', 'SAH',
    'OH', 'MEE', 'SIN', 'YOU', 'SUL', 'HAE' );
    SizeOfMonth : array[1..12] of Integer =
    ( 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
    Weekday : array[1..7] of string =
    ( 'SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT' );

    Var
    LunarLeap : Integer;
    m1, m2, n2 : Integer;
    i, j, k1, k2, k : Integer;
    leap : Boolean;
    DayTotal : LongInt;

    begin
    m1 := 0;
    DayTotal := 0;

    If LunarYear <> 1881 Then Begin
    m1 := LunarYear - 1882 + 1;
    For i := 1 To m1 Do Begin
    For j := 1 To 13 Do DayTotal := DayTotal + kk[i][j];
    If kk[i][13] = 0 Then DayTotal := DayTotal + 336
    Else DayTotal := DayTotal + 362
    end;
    end;

    m1 := m1 + 1;
    n2 := LunarMonth;
    m2 := 0;
    While True Do Begin
    m2 := m2 + 1;
    If kk[m1][m2] > 2 Then begin
    DayTotal := DayTotal + 26 + kk[m1][m2];
    n2 := n2 + 1;
    End
    else If m2 = n2 Then break
    else DayTotal := DayTotal + 28 + kk[m1][m2]
    End;

    DayTotal := DayTotal + LunarDay + 29;
    m1 := 1880;
    While True Do Begin
    m1 := m1 + 1;
    leap := ((m1 mod 400) = 0) Or ((m1 mod 100) <> 0) And ((m1 mod 4) = 0);
    If leap Then m2 := 366
    Else m2 := 365;
    If DayTotal <= m2 Then break;
    DayTotal := DayTotal - m2;
    End;

    SolarYear := m1;

    SizeOfMonth[2] := m2 - 337;
    m1 := 0;
    While True Do Begin
    m1 := m1 + 1;
    If DayTotal <= SizeOfMonth[m1] Then break;
    DayTotal := DayTotal - SizeOfMonth[m1];
    End;
    SolarMonth := m1;
    SolarDay := DayTotal;
    end;

    end.