ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î

À½·Â - ¾ç·Â º¯È¯±â
13³â Àü
$Lunar_Month = array(
/* 1881 */ // 1881³â 1¿ù 30ÀÏÀº À½·Â 1¿ù 1ÀÏ
    "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"
);

function is_yun_year($year)
{
        if ($year % 4 != 0) return 0;   /* not yun year */
        if ($year % 100 != 0) return 1; /* yun year */
        if ($year % 400 != 0) return 0;  /* not yun year */
        return 1;                                               /* yun year */
}


function how_many_days($year, $month)
{
    switch($month)
    {
    case 1: case 3: case 5: case 7: case 8: case 10: case 12:
        return 31;
    case 4: case 6: case 9: case 11:
        return 30;
    case 2:
        if (is_yun_year($year)) return 29;
        else return 28;
    }
}

function end_day_of_lunar_month($year, $month)
{
    global $Lunar_Month;

    for ($i = 0; $i < $month; $i++) {
        $flag = $Lunar_Month[$year-1880][$i];
        if ($flag == '3' || $flag == '4') break;
    }
    if ($i != month)
        $flag = $Lunar_Month[($year-1880)*13+$month];
    else $flag = $Lunar_Month[($year-1880)*13+$month-1];

    if ($flag == '1') return 29;
    else return 30;
}

function solar_to_lunar($year, $month, $day)
{
    global $Lunar_Month , $lunar_date;
    $total_day = 0;

    // ÇØÀÇ ¹üÀ§¸¦ ÃøÁ¤ÇÑ´Ù.
    if ($year < 1881 || $year > 2043) return -1;

    for ($i = 0; $i < 163; $i++) {
        $Sum_of_Lunar_Day[$i]=0;  // 1³âÀÇ À½·Â ³¯ÀÚÀÇ ÇÕÀ» ÀúÀåÇÏ´Â ¹è¿­

        $list_of_year[$i]=1881+$i;

        for ($j = 1; $j <= 13; $j++) {
            $this_month = $i*13+$j-1;
            switch($Lunar_Month[$this_month]) {
                case '0':
                    break;
                case '1': case '3':
                    $Sum_of_Lunar_Day[$i] = $Sum_of_Lunar_Day[$i] + 29;
                    $imsi=29;
                    break;
                case '2': case '4':
                    $Sum_of_Lunar_Day[$i] = $Sum_of_Lunar_Day[$i] + 30;
                    $imsi=30;
                    break;
            }
        }
    }

    /* ¿À´Ã±îÁöÀÇ ¾ç·Â ³¯ÀÚÀÇ ÇÕ±¸Çϱâ. */
    /* 1881-1-30ÀÌ À½·Â 1¿ù 1ÀÏÀ̳ª±ñ 1880³â±îÁö ³¯¿¡ 29ÀÏÀ» ´õÇÑ´Ù. */
    $sum_of_1881 = (int)(1880*365 + 1880/4 - 1880/100 + 1880/400 + 29);

    /* ÀԷ¹ÞÀº ³¯±îÁöÀÇ ³¯Â¥ÀÇ ÇÕ±¸Çϱâ */
    //--- À۳⠱îÁöÀÇ ³¯Â¥ÀÇ ÇÕ ---//
    $last_year=$year-1;
    $sum_of_today = (int)($last_year*365 + $last_year/4 - $last_year/100 + $last_year/400);

    //--- ÀÚ³­ ´Þ ±îÁöÀÇ ³¯Â¥ÀÇ ÇÕ ---//
    for($i = 1; $i < $month ; $i++){
        $sum_of_today = $sum_of_today + how_many_days($year,$i);
    }

    //--- ¿À´Ã±îÁöÀÇ ³¯Â¥ÀÇ ÇÕ ---//
    $sum_of_today = $sum_of_today + $day;

    // ¿À´Ã±îÁöÀÇ ³¯Â¥ ÇÕ¿¡¼­ 1881³â 1¿ù 29ÀÏÀÇ ³¯Â¥ÀÇ ÇÕÀ» »«´Ù.//
    // $total_day´Â ³¯Â¥ÀÇ Â÷ÀÌ..
    if($year == 1881) $total_day  = $sum_of_today - $sum_of_1881;
    else $total_day  = $sum_of_today - $sum_of_1881 -1;

    //--------------------------------------------------------------------//
    // ÀÌÁ¦ ºÎÅÍ À½·ÂÀ» °è»ê ÇÑ´Ù..
    $total_imsi = $Sum_of_Lunar_Day[0];
    for($i = 0; $i < 163; $i++) {
        if ($total_day <= $total_imsi) break;
        else $total_imsi = $total_imsi + $Sum_of_Lunar_Day[$i + 1];
    }

    $lun_year = $i + 1881; // À½·Â ³âµµ ±¸ÇÔ..

    $ext_total_day = $total_day - $total_imsi + $Sum_of_Lunar_Day[$i];;

    if ($Lunar_Month[$i*13+12] == '0') $count = 12;
    else $count = 13;

    $m2 = 0;
    for ($j = 0; $j < $count; $j++) {
        $this = $i*13+$j;
        if ($Lunar_Month[$this] == 1) {
            $m2++;
            $m1 = $Lunar_Month[$this] + 28;
            $is_yun_month = 0;
        }
        else if ($Lunar_Month[$this] == 2) {
            $m2++;
            $m1 = $Lunar_Month[$this] + 28;
            $is_yun_month = 0;
        }
        else if ($Lunar_Month[$this] == 3) {
            $m1 = $Lunar_Month[$this] + 26;
            $is_yun_month = 1;
        }
        else {
            $m1 = $Lunar_Month[$this] + 26;
            $is_yun_month = 1;
        }

        // ´ÙÀ½´ÞÀÌ À±´ÞÀÎÁö ¾Æ´ÑÁö¸¦ ¸®ÅÏÇÑ´Ù..
        // ³Ñ±â´Â ÀÌÀ¯´Â »ýÀÏÀÚÀÇ Äõ¸® Àü¼ÛÀ» À§Çؼ­..
        // À½·Â À±´ÞÀÇ »ýÀÏÀÚ ¶Ç´Â Æò´Þ¿¡ ž »ýÀÏÀÚ°¡
        // À±´ÞÀÌ ´ÙÀ½´Þ¿¡µµ ³ª¿ÀÁö ¾Ê°Ô.
        // ±×·¯´Ï±ñ »ýÀÏÀÌ µÎ¹ø »ý±âÁö ¾Êµµ·Ï

        $next = $i*13+$j+1;
        if ($Lunar_Month[$next] == 1) $next_is_yun_month = 0;
        else if ($Lunar_Month[$next] == 2) $next_is_yun_month = 0;
        else if ($Lunar_Month[$next] == 3) $next_is_yun_month = 1;
        else $next_is_yun_month = 1;


        if ($ext_total_day <= $m1) break;
        $ext_total_day = $ext_total_day - $m1;
    }

    $lunar_year = $lun_year;
    $lunar_month = $m2;
    $lunar_day = (int)($ext_total_day);
    $is_lunar = $is_yun_month;
    $next_is_lunar =$next_is_yun_month;

    if($lunar_month <10) $lunar_month="0".$lunar_month;
    if($lunar_day <10) $lunar_day="0".$lunar_day;

    $lunar_date = "$lunar_year"."³â"." "."$lunar_month"."¿ù"." "."$lunar_day"."ÀÏ";

return $lunar_date;
}
$Y = date("Y");
$M = date("m");
$D = date("d");
solar_to_lunar($Y, $M, $D);
echo $lunar_date;
ÃßõÃßõ : 241 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
2,885
input ÀÔ·Â ÇÊµå ¾ÕµÚ °ø¹é ½Ç½Ã°£ Á¦°Å
2,884
Placeholder Æ÷Ä¿½º½Ã °¨Ãß±â
2,883
MySQL Áߺ¹µÈ µ¥ÀÌÅ͸¦ »èÁ¦
2,882
MySQL Áߺ¹ µ¥ÀÌÅÍ È®ÀÎ
2,881
sessionStorage.getItem ¿Í sessionStorage.setItem
2,880
Á¦ÀÌÄõ¸® ·£´ýÀ¸·Î ¹è°æ»ö º¯°æ
2,879
preg match¿¡ °üÇÑ Á¤±Ô½Ä
2,878
Stream an audio file with MediaPlayer ¿Àµð¿À ÆÄÀÏ ½ºÆ®¸®¹Ö Çϱâ
2,877
Audio Streaming PHP Code
2,876
PHP $ SERVER ȯ°æ º¯¼ö Á¤¸®
2,875
Vimeo (ºñ¸Þ¿À) API ¸¦ »ç¿ëÇÏ¿© Ç÷¹À̾î ÄÁÆ®·ÑÇϱâ
2,874
iframe »ç¿ë½Ã ÇÏ´Ü¿¡ ¹ß»ýÇÏ´Â °ø¹é Á¦°Å¹æ¹ý
2,873
¾ÆÀÌÇÁ·¹ÀÓ(iframe) Àüüȭ¸é °¡´ÉÇÏ°Ô Çϱâ
2,872
ºÎÆ®½ºÆ®·¦(bootstrapk)¿¡¼­ »ç¿ëÇÏ´Â class¸í Á¤¸®
2,871
ºÎÆ®½ºÆ®·¦ CSS
2,870
Å©·Ò¿¡¼­ ¸¶Áø Á¶Àý
2,869
PHP ÇöÀç ÆäÀÌÁöÀÇ µµ¸ÞÀθíÀ̳ª urlµîÀÇ Á¤º¸ ¾Ë¾Æ¿À±â
2,868
PHP preg match all()
2,867
PHP ·Î À¥ÆäÀÌÁö ±Ü¾î¿À±â ¸ðµç ¹æ¹ý ÃÑÁ¤¸®!
2,866
[PHP] ¿ø°ÝÁö ÆÄÀÏ ÁÖ¼Ò ³ëÃâ ¾ÈÇÏ°í curl·Î ´Ù¿î·Îµå ¹Þ±â
2,865
PHP ÇÔ¼ö Á¤¸®
2,864
¾ÆÀÌÇÁ·¹ÀÓ(iframe) ºñÀ² À¯ÁöÇϸ鼭 Å©±â Á¶ÀýÇÏ´Â ¹æ¹ý
2,863
PHP ¹è¿­¿¡¼­ ¹«ÀÛÀ§·Î Çϳª »Ì¾ÆÁÖ´Â array rand() ÇÔ¼ö
2,862
PHP Á¤±Ô½Ä Á¤¸®
2,861
PHP Á¤±Ô½ÄÀ» È°¿ëÇÑ ÅÂ±× ¹× ƯÁ¤ ¹®ÀÚ¿­ Á¦°Å ¹× ÃßÃâ ¹æ¹ý
2,860
php Å©·Ñ¸µ ¶Ç´Â ÆÄ½Ì ÇÔ¼ö, Á¤±Ô½Ä ¸ðÀ½
2,859
Á¦ÀÌÄõ¸® ±âº» ¸í·É¾î
2,858
À¥ÆäÀÌÁö °¡·Î ¸ðµå¼¼·Î ¸ðµå ÀνÄÇϱâ
2,857
¸ð¹ÙÀÏ À¥ È­¸é °­Á¦ ȸÀü(°¡·Î¸ðµå °íÁ¤)
2,856
[HTML5]¿¡¼­ frameset ´ëü ¹æ¹ý°ú iframe ¼Ó¼º
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.