| 
	
 | 
 Posted by Kimmo Laine on 06/20/34 11:48 
"Des" <desotuatail@aol.com> wrote in message  
news:1148464191.266932.319310@38g2000cwa.googlegroups.com... 
>I have to do an events calender for a church. The events display will 
> be limited to that week. If someone went in today Wed 24th I want to 
> display 21st to 27th. I dont want any code samples, just the functions 
> that find the day of week and a function that can (in this case) 
> subtract 3 days to get sunday and add 7 for saterday. I can do the 
> rest. 
> 
 
I'd try something like this: 
 
$lastsunday = date('w')==0 ? mktime() : strtotime('last sunday'); 
// If today _is_ sunday, then today, else last sunday 
echo date('Y-m-d',$lastsunday); 
 
$nextsaturday = strtotime('next saturday',$dateforlastsunday); 
// Next saturday counting from the given sunday. 
echo date('Y-m-d',$lastsaturday); 
 
strtotime is a pretty darn good way for getting expressional dates like  
"next month" or "last year" etc. 
 
--  
"ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk 
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)
 
  
Navigation:
[Reply to this message] 
 |