note 68111 added to function.date
| From: | dulareatgmaildotcom at osu1 dot php dot net | Date: | Thu, 13 Jul 2006 15:36:20 +0000 |
| Subject: | note 68111 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114737@lists.php.net to get a copy of this message | ||
If You are looking for some simple date calculations:
<?
function days_between($fyear, $fmonth, $fday, $tyear, $tmonth, $tday)
{
return abs((mktime ( 0, 0, 0, $fmonth, $fday, $fyear) - mktime ( 0, 0, 0, $tmonth, $tday,
$tyear))/(60*60*24));
}
function day_before($fyear, $fmonth, $fday)
{
return date ("Y-m-d", mktime (0,0,0,$fmonth,$fday-1,$fyear));
}
function next_day($fyear, $fmonth, $fday)
{
return date ("Y-m-d", mktime (0,0,0,$fmonth,$fday+1,$fyear));
}
function weekday($fyear, $fmonth, $fday) //0 is monday
{
return (((mktime ( 0, 0, 0, $fmonth, $fday, $fyear) - mktime ( 0, 0, 0, 7, 17,
2006))/(60*60*24))+700000) % 7;
}
function prior_monday($fyear, $fmonth, $fday)
{
return date ("Y-m-d", mktime (0,0,0,$fmonth,$fday-weekday($fyear, $fmonth,
$fday),$fyear));
}
?>
----
Server IP: 83.64.128.68
Probable Submitter: 83.16.5.174
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/note/edit/68111
Del: integrated -- http://master.php.net/note/delete/68111/integrated
Del: useless -- http://master.php.net/note/delete/68111/useless
Del: bad code -- http://master.php.net/note/delete/68111/bad+code
Del: spam -- http://master.php.net/note/delete/68111/spam
Del: non-english -- http://master.php.net/note/delete/68111/non-english
Del: in docs -- http://master.php.net/note/delete/68111/in+docs
Del: other reasons-- http://master.php.net/note/delete/68111
Reject -- http://master.php.net/note/reject/68111
Search -- http://master.php.net/manage/user-notes.php