note 119314 added to dateinterval.createfromdatestring

From: Date: Wed, 11 May 2016 18:43:18 +0000
Subject: note 119314 added to dateinterval.createfromdatestring
Groups: php.notes 
Request: Send a blank email to php-notes+get-205461@lists.php.net to get a copy of this message
/** * regresa feriado de semana santa se calcula segun calendario lunar, primer fin de semana tras luna llena * despues del equinoccio de otoño * @param integer anio año a revisar * @return array arreglo de la forma fecha[]='dd,mm' */ function viernesSanto($anio) { date_default_timezone_set('America/Santiago'); $mesLunar = 29.53; //dias $lunaLlena = new \DateTime('2016-01-24'); // primer luna llena 2016 $equinoccio = new \DateTime($anio.'-03-21'); // 3 de marzo $intervalo = $equinoccio->diff($lunaLlena); $dias = $intervalo->days; $proximaLunaLLenaTrasEquinoccioEnDias=ceil(floor($dias/$mesLunar)*$mesLunar+$mesLunar); $intervaloProximaLunaLLena = new \DateInterval('P'.$proximaLunaLLenaTrasEquinoccioEnDias.'D'); $proximaLunaLlena = $lunaLlena->add($intervaloProximaLunaLLena); list($dd,$mm) = explode('-',$proximaLunaLlena->format('d-m')); $diaSemana = date('w',mktime(0,0,0,$mm,$dd,$anio)); $domingo = strtotime(date('Y-m-d',strtotime('-'.$diaSemana.' day',strtotime(date($anio.'-'.$mm.'-'.$dd))))); list($dd,$mm) = explode('-',date('d-m',strtotime('+5 day',$domingo))); return array('dia'=>$dd,'mes'=>$mm); } ---- Server IP: 72.52.91.14 Probable Submitter: 200.6.114.91 ---- Manual Page -- http://php.net/manual/en/dateinterval.createfromdatestring.php Edit -- https://master.php.net/note/edit/119314 Del: integrated -- https://master.php.net/note/delete/119314/integrated Del: useless -- https://master.php.net/note/delete/119314/useless Del: bad code -- https://master.php.net/note/delete/119314/bad+code Del: spam -- https://master.php.net/note/delete/119314/spam Del: non-english -- https://master.php.net/note/delete/119314/non-english Del: in docs -- https://master.php.net/note/delete/119314/in+docs Del: other reasons-- https://master.php.net/note/delete/119314 Reject -- https://master.php.net/note/reject/119314 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#205461) next »