Re: date problem: some months have 5 weeks... how I discoverwhich ones?
| From: | jeremy brand | Date: | Fri, 19 Jan 2001 00:49:01 +0000 |
| Subject: | Re: date problem: some months have 5 weeks... how I discoverwhich ones? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35528@lists.php.net to get a copy of this message | ||
> For a newspaper, a week start on sunday and ends in a saturday.
>
> Media planners divide ads in newspapers by monhs and than by weeks,
> respectively.
Well, this _seems_ contradictory to your original "definition", but I
got it.
> so let's say:
>
> january 2001 started in a monday
>
> Su Mo Tu We Th Fr Sa
> 1 2 3 4 5 6 - 1st week
> 7 8 9 10 11 12 13 - 2nd week
> 14 15 16 17 18 19 20 - 3rd week
> 21 22 23 24 25 26 27 - 4th week
> 28 29 30 31 - 5th week
Well, get the timestamp of the first of the month:
$ts = mktime(0,0,0,1,1,2001);
then add 7 days worth of secnds to it until the month is no longer
January:
while ((int)date('m',$ts) == 1)
{
//do stuff for this week
$ts += (60*60*24*7);
}
> So january is a month that has 5 weeks for a newspaper, because if I would
> put an ad on a tuesday, january has 5 tuesdays.. got it?
>
> How do I do to calculate that?
I hope this help. It should give you the general idea. I don't
have time to write your whole application. ;-) Hopefully I gave you
enough to get you going in the right direction.
Ultimately you are going to need to cutomize this for what you exactly
want to do.
Jeremy
Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: jeremy@nirvani.net
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"LINUX is obsolete" -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
http://www.JEEP-FOR-SALE.com/ -- I need a buyer
Get your own Free, Private email at http://www.smackdown.com/