note 84533 added to function.date

From: Date: Thu, 17 Jul 2008 16:30:37 +0000
Subject: note 84533 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-141635@lists.php.net to get a copy of this message
to get the date of the monday from a week these function is useful: /* Get First Calendar Week of Year x*/ function firstkw($jahr) { $erster = mktime(0,0,0,1,1,$jahr); $wtag = date('w',$erster); if ($wtag <= 4) { /** * Donnerstag oder kleiner: auf den Montag zurückrechnen. */ $montag = mktime(0,0,0,1,1-($wtag-1),$jahr); } else { /** * auf den Montag nach vorne rechnen. */ $montag = mktime(0,0,0,1,1+(7-$wtag+1),$jahr); } return $montag; } /*GET timestamp of monday of month x*/ function mondaykw($kwtime) { $firstmonday =$this->firstkw(date("Y", $kwtime)); $mon_monat = date('m',$firstmonday); $mon_jahr = date('Y',$firstmonday); $mon_tage = date('d',$firstmonday); $tage = (date("W", $kwtime)-1)*7; $mondaykw = mktime(0,0,0,$mon_monat,$mon_tage+$tage,$mon_jahr); return $mondaykw; } echo mondaykw(time()); //1215986400 ---- Server IP: 217.13.201.10 Probable Submitter: 79.214.120.175 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/84533 Del: integrated -- https://master.php.net/note/delete/84533/integrated Del: useless -- https://master.php.net/note/delete/84533/useless Del: bad code -- https://master.php.net/note/delete/84533/bad+code Del: spam -- https://master.php.net/note/delete/84533/spam Del: non-english -- https://master.php.net/note/delete/84533/non-english Del: in docs -- https://master.php.net/note/delete/84533/in+docs Del: other reasons-- https://master.php.net/note/delete/84533 Reject -- https://master.php.net/note/reject/84533 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141635) next »