note 70838 added to function.mktime

From: Date: Tue, 31 Oct 2006 09:28:58 +0000
Subject: note 70838 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-119263@lists.php.net to get a copy of this message
As I see it, this function should default to zero for the first 3 arguments but one for the next two. It makes sense to talk about the 0th hour of the day (midnight) or the 0th minute of the hour or the 0th second of the minute, but it makes no sense to talk about the 0th day of the month or the 0th month of the year. The example of why this change should happen is below: <select id="month" name="month"> <?php for ($i = 1; $i <= 12; $i++) echo '<option value="'.$i.'">'.date('F',mktime(0,0,0,$i)).'</option>'; ?> </select> Produces a list of meaningless months. To make it useful, you have to add an extra argument to mktime. <?php mktime(0,0,0,$i,1) ?> ---- Server IP: 85.116.0.130 Probable Submitter: 195.248.103.49 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- https://master.php.net/note/edit/70838 Del: integrated -- https://master.php.net/note/delete/70838/integrated Del: useless -- https://master.php.net/note/delete/70838/useless Del: bad code -- https://master.php.net/note/delete/70838/bad+code Del: spam -- https://master.php.net/note/delete/70838/spam Del: non-english -- https://master.php.net/note/delete/70838/non-english Del: in docs -- https://master.php.net/note/delete/70838/in+docs Del: other reasons-- https://master.php.net/note/delete/70838 Reject -- https://master.php.net/note/reject/70838 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119263) next »