Re: Date Issue

From: Date: Mon, 17 Nov 2008 17:42:06 +0000
Subject: Re: Date Issue
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-283376@lists.php.net to get a copy of this message
Boyd, Todd M. wrote:
-----Original Message----- From: admin@buskirkgraphics.com [mailto:admin@buskirkgraphics.com] Sent: Monday, November 17, 2008 10:50 AM To: php-general@lists.php.net Subject: [PHP] Date Issue $smont = 10; $sday = 13; $syear = 2008; $timestamp = mktime(0,0,0,$smont,$sday,$syear); $thismonth = getdate($timestamp); Here is where the problem comes into play. echo $thismonth['yday']; This displays 286 when in fact its 287. Is there a problem in my ini file or what is the deal.
Are you sure this isn't like Javascript's "getMonth" function? Its index may begin at 0, making "day 0" the "first day" of the year. HTH, Todd Boyd Web Programmer
yup.. <?php $thismonth = getdate(mktime(0,0,0,1,1,2008)); echo $thismonth['yday'] . PHP_EOL; //0 $thismonth = getdate(mktime(0,0,0,12,31,2008)); echo $thismonth['yday'] . PHP_EOL; //365 ?> (it is a leap year) so recap: yday 0 = 1st jan

« previous php.general (#283376) next »