note 97708 added to function.getdate

From: Date: Tue, 04 May 2010 12:53:44 +0000
Subject: note 97708 added to function.getdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-168916@lists.php.net to get a copy of this message
This function gives you the last working day of the month, unless that day is a Saturday or a Sunday (weekend) day for example if you need to get the day when salaries are paidon. <? function LastWorkDayOfMonth(){ //function returns $result = strtotime("{$this->year}-{$this->month}-01"); //setting pointer $result = strtotime('-1 second', strtotime('+1 month', $result)); //geting last day $theday=getdate($result); if ($theday[weekday]=="Sunday"){ // if Sunday move pointer -2 days $result = strtotime('-2 day', $result); } if ($theday[weekday]=="Saturday"){ // if Saturday move pointer -1 day $result = strtotime('-1 day', $result); } return date('Y-m-d', $result); // return result } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 81.97.207.96 ---- Manual Page -- http://www.php.net/manual/en/function.getdate.php Edit -- https://master.php.net/note/edit/97708 Del: integrated -- https://master.php.net/note/delete/97708/integrated Del: useless -- https://master.php.net/note/delete/97708/useless Del: bad code -- https://master.php.net/note/delete/97708/bad+code Del: spam -- https://master.php.net/note/delete/97708/spam Del: non-english -- https://master.php.net/note/delete/97708/non-english Del: in docs -- https://master.php.net/note/delete/97708/in+docs Del: other reasons-- https://master.php.net/note/delete/97708 Reject -- https://master.php.net/note/reject/97708 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168916) next »