[PHP] Weekly Separation

2001-07-18 Thread Chris Aitken

Hey all,


Im working on a system to be able to take a big list of entries that is 
sorted by a date field, and be able to identify them into weekly groups 
(monday to monday or sunday to sunday etc).

So basically, for the example here, say I had 100 entries over a 1 month 
period. What I want to be able to do is, as the 'while' loop is running, 
every time a weeks worth of entries passes it does some defined task 
(alternate colour, insert a line break or whatever).

Ive been working on a way but it seems a very long and involved method. Has 
anyone got any pointers or ideas they might be able to throw at me so I can 
make this a more simple method.



Thanks


Chris


--
 Chris Aitken - Administration/Database Designer - IDEAL Internet
  email: [EMAIL PROTECTED]  phone: +61 2 4628   fax: +61 2 4628 8890
  __-__
   *** Big Brother ***
It just shows that the dull will rule the world. And we will be watching it.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Weekly Separation

2001-07-18 Thread Jason Murray

> Ive been working on a way but it seems a very long and 
> involved method. Has anyone got any pointers or ideas 
> they might be able to throw at me so I can make this 
> a more simple method.

Assuming you know the date of each entry, do a Date("z")
(day of the year), and divide it by 7. 

Store that and compare it next time around the loop.

If it's different then a week has passed and you can 
do Fun Stuff(tm).

If it's the same then it hasn't.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Developer, Melbourne IT
"Work now, freak later!"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]