note 80965 added to function.date
| From: | lev dot ananikyan at gmail dot com | Date: | Fri, 08 Feb 2008 15:39:13 +0000 |
| Subject: | note 80965 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135911@lists.php.net to get a copy of this message | ||
More elegant way to find week's end and begin for any date.
$day = isset($_GET['day'])? $_GET['day']: date("d",time());
$month = isset($_GET['month'])? $_GET['month']: date("m",time());
$year = isset($_GET['year'])? $_GET['year']: date("Y",time());
$w = date('w',mktime(0,0,0,$month,$day,$year));//Week day
$start_date = mktime(0, 0, 0, $month, $day-$w+1, $year); //Timestamp of Start
$end_date = mktime(0, 0, 0, $month, $day-$w+8 , $year); //Timestamp of End
----
Server IP: 195.250.77.48
Probable Submitter: 91.103.27.190
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/80965
Del: integrated -- https://master.php.net/note/delete/80965/integrated
Del: useless -- https://master.php.net/note/delete/80965/useless
Del: bad code -- https://master.php.net/note/delete/80965/bad+code
Del: spam -- https://master.php.net/note/delete/80965/spam
Del: non-english -- https://master.php.net/note/delete/80965/non-english
Del: in docs -- https://master.php.net/note/delete/80965/in+docs
Del: other reasons-- https://master.php.net/note/delete/80965
Reject -- https://master.php.net/note/reject/80965
Search -- https://master.php.net/manage/user-notes.php