note 27451 added to function.date
| From: | Arheddis_Varkenjaab at Aynayda dot Pizaqvic dot com | Date: | Fri, 06 Dec 2002 11:23:56 +0000 |
| Subject: | note 27451 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40415@lists.php.net to get a copy of this message | ||
Me an my Cronjob no longer forgett birthdays.
returns 0, if you don't have to matter,
2, two days before the birthday (for me it sends mail)
and 1 on birthday (for me it sends mail to whoever has)
feed it with "06.12" or "24.01" .... small modifications in ereg() and your
parameter may look as you like it...
function datecalc($input) {
if (ereg("([0-9]{1,2}).([0-9]{1,2})", $input, $abc)) {
$ak_d = date("d");$ak_m = date("m");
if($abc[2] == $ak_m){
if($abc[1] == $ak_d)
return 1;
elseif(($abc[1]-$ak_d)==2)
return 2;
} elseif ($ak_m == $abc[2]-1) {
if($abc[1]==2) {
if(date("t") == $ak_d)
return 2;
}elseif($abc[1]==1){
if((date("t")-1) == $ak_d)
return 2;
}
}
return 0;
} else {
return 0;
}
} // function
ciao !
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+27451
http://master.php.net/manage/user-notes.php?action=delete+27451
http://master.php.net/manage/user-notes.php?action=reject+27451