note 98063 deleted from function.date by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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++;
	}
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.