note 79056 added to ref.calendar

From: Date: Thu, 08 Nov 2007 13:27:07 +0000
Subject: note 79056 added to ref.calendar
Groups: php.notes 
Request: Send a blank email to php-notes+get-132111@lists.php.net to get a copy of this message
Well this is the second part, well more the second calendar of Maya the Tikal there is two of them one for long count, one for general date seeding, this is using an implementation of floating point time (roun). <?php $maya = MayanTikalCalendar(time(),0); print_r($maya); $poffset = '2012-12-21 8:24 PM', $pweight = '-1872000.22222222223', $defiency='nonedeficient', $timeset= array("hours" => 24, "minutes" => 60, "seconds" => 60)) { // Code Segment 1 – Calculate Floating Point $tme = $unix_time; if ($gmt>0){ $gmt=-$gmt; } else { $gmt=abs($gmt); } $ptime = strtotime($poffset)+(60*60*gmt); $maya_xa = ($tme)/(24*60*60); $maya_ya = $ptime/(24*60*60); $maya = (($maya_xa -$maya_ya) - $pweight)+(microtime/999999); // Code Segment 2 – Set month day arrays $nonedeficient = array( "seq1" => array(20,20,20,20,20,20,20,20,20, 20,20,20,20,20,20,20,20,20,5)); $monthnames = array("seq1" => array( 'Pop', 'Uo', 'Zip', 'Zot\'z', 'Tzec', 'Xul', 'Yaxkin', 'Mol', 'Ch\'en', 'Yax', 'Zac', 'Ceh', 'Mac', 'Kankin', 'Muan', 'Pax', 'Kayab', 'Cumku', 'Uayeb')); $daynames = array("seq1" => array( 'Imix', 'Ik', 'Akbal', 'Kan', 'Chicchan', 'Cimi','Manik', 'Lamat', 'Muluc', 'Oc', 'Chuen', 'Eb', 'Ben', 'Ix', 'Men', 'Cib', 'Caban', 'Etz\'nab', 'Cauac', 'Ahau')); $monthusage = isset($defiency) ? ${$defiency} : $deficient; // Code Segment 3 – Calculate month number, day numbers etc foreach($monthusage as $key => $item){ $i++; foreach($item as $numdays){ $ttl_num=$ttl_num+$numdays; $ttl_num_months++; } } $revolutionsperyear = $ttl_num / $i; $numyears = (round((floor($maya) / $revolutionsperyear),0)); $avg_num_month = $ttl_num_months/$i; $jtl = abs(abs($maya) - ceil($revolutionsperyear*($numyears+1))); while($month==0){ $day=0; $u=0; foreach($monthusage as $key => $item){ $t=0; foreach($item as $numdays){ $t++; $tt=0; for($sh=1;$sh<=$numdays;$sh++){ $ii=$ii+1; $tt++; if ($ii==floor($jtl)){ if ($maya>0){ $daynum = $tt; $month = $t; } else { $daynum = $numdays-$tt; $month = $avg_num_month-$t; } $sequence = $key; $nodaycount=true; } } if ($nodaycount==false) $day++; } $u++; } } $timer = substr($maya, strpos($maya,'.')+1, strlen($maya)-strpos($maya,'.')-1); $maya_out= $numyears.'/'.$month.'/'.$daynum.' '.$day.'.'. floor(intval(substr($timer,0,2))/100*$timeset['hours']).':'. floor(intval(substr($timer,2,2))/100*$timeset['minutes']).':'. floor(intval(substr($timer,4,2))/100*$timeset['seconds']).'.'. substr($timer,6,strlen($timer)-6); $maya_obj = array( 'longcount'=>MayanLongCount($tme),'year'=>abs($numyears), 'month'=>$month, 'mname' => $monthnames[$sequence][$month-1], 'day'=>$daynum, 'dayname'=>$daynames[$sequence][$daynum-1], 'day'=>$daynum, 'jtl'=>$jtl, 'day_count'=>$day, 'hours'=> floor(intval(substr($timer,0,2))/100 *$timeset['hours']), 'minute'=> floor(intval(substr($timer,2,2))/100 *$timeset['minutes']), 'seconds'=>floor(intval(substr($timer,4,2))/100 *$timeset['seconds']), 'microtime'=>substr($timer,6,strlen($timer)-6), 'strout'=>$maya_out); return $maya_obj; } ?> ---- Server IP: 203.220.0.234 Probable Submitter: 125.253.8.126 ---- Manual Page -- http://www.php.net/manual/en/ref.calendar.php Edit -- https://master.php.net/note/edit/79056 Del: integrated -- https://master.php.net/note/delete/79056/integrated Del: useless -- https://master.php.net/note/delete/79056/useless Del: bad code -- https://master.php.net/note/delete/79056/bad+code Del: spam -- https://master.php.net/note/delete/79056/spam Del: non-english -- https://master.php.net/note/delete/79056/non-english Del: in docs -- https://master.php.net/note/delete/79056/in+docs Del: other reasons-- https://master.php.net/note/delete/79056 Reject -- https://master.php.net/note/reject/79056 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132111) next »