You are here: Re: Date, beginning of week « All PHP « IT news, forums, messages
Re: Date, beginning of week

Posted by Steve on 03/02/07 14:57

"Steve" <no.one@example.com> wrote in message
news:KOWFh.11$0P1.5@newsfe06.lga...
|
| "Steve" <no.one@example.com> wrote in message
| news:nvWFh.6$0P1.0@newsfe06.lga...
||| I'm trying to write a script that works out the day of week, goes back
to
||| previous Monday, then removes a week and sets up 2 timestamps.
||
|| $today = strtotime(date('m/d/Y') . ' 00:00');
|| $monday = strtotime('last monday', $today);
|| $monday = strtotime('last monday', $monday);
|| $sunday = strtotime('next sunday', $monday);
||
|| print_r(array(date('D j M y H:i:s a', $monday), date('D j M y H:i:s a',
|| $sunday)));
|
| rik brought up a good point. if $today is monday, do you want the monday 2
| weeks ago or just one. while i love date math, i think this may be more
| understandable for the novice:
|
| $today = strtotime(date('m/d/Y') . ' 00:00');
| $monday = strtotime('last monday', $today);
| if (intval(strftime('%w', $monday)) != 0)

lol...it's still early for me. change that to:

if (intval(strftime('%w', $today)) != 0)

 

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

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