note 59071 added to function.date
| From: | (dot) | Date: | Fri, 25 Nov 2005 14:29:28 +0000 |
| Subject: | note 59071 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99078@lists.php.net to get a copy of this message | ||
Here is a little code to find the last day number of tuesday
<?php
//today in number
$dia = date("j");
/*last month in number*/
$mes = mktime(0, 0, 0, date("m")-1, date("d"), date("Y"));
/*number of day*/
$tipo = date("w");
switch ($tipo)
{
case 0:
$resula = $dia-3;
break;
case 1:
$resula = $dia-4;
break;
case 2:
$resula = $dia-5;
break;
case 3:
$resula = $dia-6;
break;
case 4:
$resula = $dia;
break;
case 5:
$resula = $dia-1;
break;
case 6:
$resula = $dia-2;
break;
}
/*comprovations*/
if ($dia < 7&& $tipo != 4){$resul = $mes+$resula;}else{$resul = $resula;}
echo $resul;
?>
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59071
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59071&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59071&report=yes
Search -- http://master.php.net/manage/user-notes.php