You are here: Re: Date manipulation PLEASE « PHP Programming Language « IT news, forums, messages
Re: Date manipulation PLEASE

Posted by Kimmo Laine on 12/18/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация