I'm creating an alternative calendar system, basically its function is you can type in a date and get the glyph in my system that corresponds with that particular day on our 14 months of 26 days calendar(364 day years) which does not use leap years. I had it completely working but forgot one important detail.. To figure in the leap years.

currently the script compares todays date with the date of nov 11, 2011. based on that date it calculates how many days had past and then determines which glyph corresponds. The current version calculates dates perfectly until the from the leapyear before to the leapyear after.

here's the script - any ideas on how I might factor in the leap year? Please excuse my rookie styles I'm new at this and it is really boggling my mind. Thanks for any suggestions!

<?php

$elvenportal = mktime(11,11,11,11,11,2011);

$now = mktime(date("H"),date("i"),date("s"),date("n"),date("j"),date("Y"));

$late = date("H");

$theeday = date("d")-1;

if ($late < 7) {$now = mktime(11,11,11,date("n"),$theeday,date("Y"));};

if ($_POST["dayz"] != "" ){

if ($_POST["month"] != "" ){

if ($_POST["year"] != "" ){

$now = mktime(11,11,11,$_POST["month"],$_POST["dayz"],$_POST["year"]);

};};};

$offset = $now - $elvenportal;

$beyondportal = abs($offset/(60*60*24));

$beyondportal = abs($beyondportal+108);

$day = abs($beyondportal % 26 + 1); //26 days in the cycle. +1 to make it 1-26 rather than 0-25

$cycle = abs(intval($beyondportal / 26) % 14+1); //14 cycles in a year - like a month. +1 to make it 1-14 rather than 0-13

if ($elvenportal > $now){

if ($day == 6){$day = 4;}

else if ($day == 7){$day = 3;}

else if ($day == 8){$day = 2;}

else if ($day == 9){$day = 1;}

else if ($day == 10){$day = 26;}

else if ($day == 11){$day = 25;}

else if ($day == 12){$day = 24;}

else if ($day == 13){$day = 23;}

else if ($day == 14){$day = 22;}

else if ($day == 15){$day = 21;}

else if ($day == 16){$day = 20;}

else if ($day == 17){$day = 19;}

else if ($day == 18){$day = 18;}

else if ($day == 19){$day = 17;}

else if ($day == 20){$day = 16;}

else if ($day == 21){$day = 15;}

else if ($day == 22){$day = 14;}

else if ($day == 23){$day = 13;}

else if ($day == 24){$day = 12;}

else if ($day == 25){$day = 11;}

else if ($day == 26){$day = 10;}

else if ($day == 1){$day = 9;}

else if ($day == 2){$day = 8;}

else if ($day == 3){$day = 7;}

else if ($day == 4){$day = 6;}

else if ($day == 5){$day = 5;}

else if ($day == 6){$day = 4;};

if ($beyondportal > 4){

if ($cycle == 1){$cycle = 8;}

else if ($cycle == 2){$cycle = 7;}

else if ($cycle == 3){$cycle = 6;}

else if ($cycle == 4){$cycle = 5;}

else if ($cycle == 5){$cycle = 4;}

else if ($cycle == 6){$cycle = 3;}

else if ($cycle == 7){$cycle = 2;}

else if ($cycle == 8){$cycle = 1;}

else if ($cycle == 9){$cycle = 14;}

else if ($cycle == 10){$cycle = 13;}

else if ($cycle == 11){$cycle = 12;}

else if ($cycle == 12){$cycle = 11;}

else if ($cycle == 13){$cycle = 10;}

else if ($cycle == 14){$cycle = 9;};

};

};

?>