Re: Need to know the date of the Monday for the week I'm in.
| From: | Scott Hurring | Date: | Mon, 07 Apr 2003 21:16:29 +0000 |
| Subject: | Re: Need to know the date of the Monday for the week I'm in. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142754@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Find out the current DOW, then subtract 1 (becuase DOW starts
at sunday, not monday), then mktime() and that's monday!
<?
$dow = date("w");
print "Today is dow $dow (Monday is 1)\n";
$offset = ($dow -1);
if ($offset <0)
$offset = 6;
print "Offset = $offset\n";
print "Previous monday is: ".
date("M d, Y", mktime(0,0,0,date('m'), date('d')-$offset,
date('Y') ));
?>
- --
Scott Hurring <scotth at eac dot com>
Systems Programmer
EAC Corporation
- ---
"Daevid Vincent" <daevid@daevid.com> wrote in message
news:002501c2fd49$abaa9b80$a50aa8c0@Locutus...
> no. i mean that say the date was Wednesday April 9th (20030409), what i want
> is to know Monday April 7th (20030407). I should get the same result
> (20030407) if i pass in 20030413 as well, since that'd be the sunday of the
> same week (weeks go Mon - Sun in my calendar)
>
> -----Original Message-----
> From: Jay Fitzgerald [mailto:jayfitz@bayou.com]
> Sent: Monday, April 07, 2003 2:02 PM
> To: Daevid Vincent
> Subject: Re: [PHP] Need to know the date of the Monday for the week I'm in.
>
>
> is this what you need?
>
> Current Date and Time is: <B><? echo date("l, F d h:i"); ?>
>
> outputs to Current Date and Time is: Monday, April 07 03:58
>
>
>
> At 01:56 PM 4/7/2003 -0700, you wrote:
>
>
> Anyone have some code that will tell me the date of the Monday for the week
> I'm in (I assume a week starts on Monday and ends on Sunday night)...
> Ideally it should be in YYYYMMDD format too.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> Jay Fitzgerald, Design Director - CPW-A, CPWDS-A, CPWDV-A, CECM-A, CWCSB-A
> Bayou Internet - http://www.bayou.com
> <http://www.bayou.com/>
> Toll Free: 888.30.BAYOU (22968)
> Vox: 318.338.2034 / Fax: 318.338.2506
> E-Mail: jayfitz@bayou.com
> ICQ: 38823829 / AIM: bayoujf / MSN: bayoujf / Yahoo: bayoujf
>
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPpHqqid4nmZjKlDXEQJLlACfVfUP8zh0vxyAgI9WGJl/HjNRcDUAmQFN
nltoo+bngpJPPwN8btSPULsy
=jLtq
-----END PGP SIGNATURE-----