note 98063 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Mon, 24 May 2010 14:05:34 +0000 |
| Subject: | note 98063 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169560@lists.php.net to get a copy of this message | ||
Note Submitter: ghotra dot navdeep at yahoo dot co dot in
----
Printing current week with dates from Monday to Sunday:
<?php
$month = date("m");
$year = date("Y");
$date = date("d");
$day = date("N");
$week_no = date("W");
if( $week_no == 1 && $day > $date ){
$year = $year - 1;
$month = 11;
$date = 31 - $day - $date;
} else {
$date = $date-$day+1;
}
$st_week_time = mktime(0, 0, 0, $month, $date, $year);
$i = 0;
while($i < 7){
if($i > 0){
$st_week_time += 86400;
}
echo date("l (d.m.Y)", $st_week_time);//print dates of from Monday to Sunday of
current week
$i++;
}
?>