Re: Need to know the date of the Monday for the week I'm in.

From: Date: Mon, 07 Apr 2003 21:35:34 +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-142758@lists.php.net to get a copy of this message
The first line tells you the day of the week numerically (and resets Monday to 0, instead of Sunday) Second line tells you the date of this weeks Monday. Third line prints as YYYY-MM-DD $date123= ((date('w') + 6) % 7); $mon_now = mktime(0,0,0,date("m"),(date("d")-$date123),date("Y")); $mon_db = date("Y-m-d", $mon_now); From here, you could figure out other Mondays with: (P1 = plus seven days, M1 = minus seven days, etc.) $mon_p1 = date("Y-m-d",strtotime("$mon_db +7 day")); $mon_m1 = date("Y-m-d",strtotime("$mon_db -7 day")); $mon_m2 = date("Y-m-d",strtotime("$mon_db -14 day")); $mon_m3 = date("Y-m-d",strtotime("$mon_db -21 day")); "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 > >

« previous php.general (#142758) next »