Re: echoing date of first and last day of current week.
| From: | Maxim Maletsky | Date: | Mon, 18 Nov 2002 17:55:36 +0000 |
| Subject: | Re: echoing date of first and last day of current week. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124951@lists.php.net to get a copy of this message | ||
probably, what you tried is the most elegant way. But, you got me: "mathematically"
I did *this* for you:
<?php
$res['day'] = date("d");
$res['month'] = date("m");
$res['year'] = date("Y");
$res['dayN'] = date("w");
$res['sunday'] = mktime (0, 0, 0, $res['month'], ($res['day']
- $res['dayN']), $res['year']);
$res['saturday'] = mktime (0, 0, 0, $res['month'], ($res['day']
+ 6 - $res['dayN']), $res['year']);
$res['sunday_debug'] = date("r", $res['sunday']);
$res['saturday_debug'] = date("r", $res['saturday']);
echo "<pre>\n";
print_r($res);
?>
Cheers, and thank my curiousity :)
--
Maxim Maletsky
maxim@php.net
"Noodle Snacks" <webmaster@tececo.com> wrote... :
> I want to get the unix timestamps of the first and last days of this week...
>
> Currently I have this:
>
> echo 'Words for the week from '.date('jS F Y',strtotime("last
> sunday")).'
> to '.date('jS F Y',strtotime ("next
> saturday")).'.<br>';
>
> on saturday this showed the 10th to 23rd... Is there a good way to do this
> mathematically (for speed) or can someone think of a better string to parse?
>
>
> --
> JJ Harrison
> lizner2002@yahoo.com.au
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>