note 93130 added to function.getdate

From: Date: Tue, 25 Aug 2009 07:32:22 +0000
Subject: note 93130 added to function.getdate
Groups: php.notes 
Request: Send a blank email to php-notes+get-159857@lists.php.net to get a copy of this message
<?php /* Function to find the first and last day of the month from the given date. * * Author Binu v Pillai binupillai2003@yahoo.com * @Param String yyyy-mm-dd * */ function findFirstAndLastDay($anyDate) { //$anyDate = '2009-08-25'; // date format should be yyyy-mm-dd list($yr,$mn,$dt) = split('-',$anyDate); // separate year, month and date $timeStamp = mktime(0,0,0,$mn,1,$yr); //Create time stamp of the first day from the give date. $firstDay = date('D',$timeStamp); //get first day of the given month list($y,$m,$t) = split('-',date('Y-m-t',$timeStamp)); //Find the last date of the month and separating it $lastDayTimeStamp = mktime(0,0,0,$m,$t,$y);//create time stamp of the last date of the give month $lastDay = date('D',$lastDayTimeStamp);// Find last day of the month $arrDay = array("$firstDay","$lastDay"); // return the result in an array format. return $arrDay; } //Usage $dayArray=array(); $dayArray=findFirstAndLastDay('2009-02-25'); print $dayArray[0]; print $dayArray[1]; ?> ---- Server IP: 59.162.86.8 Probable Submitter: 125.17.241.229 ---- Manual Page -- http://www.php.net/manual/en/function.getdate.php Edit -- https://master.php.net/note/edit/93130 Del: integrated -- https://master.php.net/note/delete/93130/integrated Del: useless -- https://master.php.net/note/delete/93130/useless Del: bad code -- https://master.php.net/note/delete/93130/bad+code Del: spam -- https://master.php.net/note/delete/93130/spam Del: non-english -- https://master.php.net/note/delete/93130/non-english Del: in docs -- https://master.php.net/note/delete/93130/in+docs Del: other reasons-- https://master.php.net/note/delete/93130 Reject -- https://master.php.net/note/reject/93130 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159857) next »