note 48289 deleted from function.date by tularis
| From: | tularis@php.net | Date: | Fri, 17 Dec 2004 22:29:53 +0000 |
| Subject: | note 48289 deleted from function.date by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81948@lists.php.net to get a copy of this message | ||
Note Submitter: zavaboy [at] zavaboy [dot] com
----
Two different ways to get the week of the current month:
<?php
echo date('Y-m-d');
// 2004-12-12
$week1 = floor((date('d')-1)/7)+1; // 3
echo 'The '.date('jS').' is the '
.$week1.date('S',mktime(0,0,0,0,$week1,0)
.' '.date('l').' this month.';
// The 12th is the 2nd Sunday this month.
$week2 = floor((date('d')-1-date('w'))/7)+2; // 2
echo 'The '.date('jS').' is in the '
.$week2.date('S',mktime(0,0,0,0,$week2,0)
.' week this month.';
// The 12th is in the 3rd week this month.
?>
Enjoy!
----
Reason: useless example