<?php
    $Anerisia = array(31,28,31,30,31,30,31,31,30,31,30,31);
    $MONTHS = array(,,,,);
    $DAYS = array(,,,,);
    $Dsuff = array('th','st','nd','rd','th','th','th','th','th','th');
    $Holy5 = array(,,,,);
    $Holy50 = array(,,,,);




    
	$edate = explode(,date('Y m j L'));
	$usery = $edate[0];
	$userm = $edate[1];
	$userd = $edate[2];
	$IsLeap = $edate[3];

  
  
  
  
  

    if (isset($_GET['y']) && isset($_GET['m']) && isset($_GET['d'])) {
        $usery = $_GET['y'];
        $userm = $_GET['m'];
        $userd = $_GET['d'];
        $IsLeap = 0;
        if (($usery%4 == 0) && ($usery%100 >0)) $IsLeap =1;
        if ($usery%400 == 0) $IsLeap = 1;
    }

 

    $userdays = 0;
    $i = 0;
    while ($i < ($userm-1)) {

        $userdays = $userdays + $Anerisia[$i];
        $i = $i +1;
    }
    $userdays = $userdays + $userd;

    
    
    
    
    

    $IsHolyday = 0;
    $dyear = $usery + 1166;
    $dmonth = $MONTHS[$userdays/73.2];
    $dday = $userdays%73;
	if (0 == $dday) $dday = 73;
    $Dname = $DAYS[$userdays%5];
    $Holyday = ;
    if ($dday == 5) {
        $Holyday = $Holy5[$userdays/73.2];
        $IsHolyday =1;
    }
    if ($dday == 50) {
        $Holyday = $Holy50[$userdays/73.2];
        $IsHolyday =1;
    }

  if (($IsLeap ==1) && ($userd ==29) and ($userm ==2)) $IsHolyday = 2;

   
   $suff = $Dsuff[$dday%10] ;
   if ((11 <= $dday) && (19 >= $dday)) $suff='th';

    

 if ($IsHolyday ==2)
      echo ,$Holyday,,$dmonth,,$dyear;
    if ($IsHolyday ==1)
      echo , $Dname , , $dday,,$suff,, , $dmonth ,  , $dyear ,  , $Holyday;
    if ($IsHolyday == 0)
       echo  , $Dname ,  , $dday ,,$suff,  , $dmonth ,  , $dyear;

 ?>