note 58728 added to function.mktime

From: Date: Mon, 14 Nov 2005 08:21:15 +0000
Subject: note 58728 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-98536@lists.php.net to get a copy of this message
A trivial way to avoid having to remember the quirky order of variables. It's also more convenient to use because you can ignore the last three (time) variables if all you want to do is manupulate the date components. Just include the following function at the top of your script and call ansi_mktime instead of mktime. function ansi_mktime($y=0, $month=0, $d=0, $h=0, $min=0, $s=0){ return mktime($h, $min, $s, $month, $d, $y); } // eg: $day = 14; echo date("dS \d\a\y of M Y", ansi_mktime(2005, 11, $day + 7)) // output: 21st day of Nov 2005 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58728 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58728&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58728&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#98536) next »