atom1
11-14-2007, 09:57 PM
Hi Everyone,
I've been going mad trying to solve this problem that I know php can do.
I have the option of either PHP4 or PHP5 on the server, so whichever is best, let me know. :o
All I am trying do is this; image several groups that meeting on certain days of the month:
e.g.
- Group 1 meets on the "1 Thursday" (first Thursday, I checked that PHP can work it out somehow using this format.
- Group 2 might meeting on the "last Friday" of the month.
I have all the data in a Mysql, have read it into an array from the db no problem with php, so take it at the simplest level without the db involved.
So here's a sample list of the groups and their "day of the months":
Group1 1 Thursday
Group2 3 Tuesday
Group3 First Thursday
Group4 1 Wednesday
Group5 3 Monday
Group6 Last Monday
Group7 2 Monday
Group8 2 Friday
Group9 2 Thursday
Group10 3 Wednesday
Group11 2 Wednesday
Group12 Last Friday
Note the "last" and "first" options in there. I have followed the php syntax as far as possible.
What bit of code will allow me to just whizz through, and work out the dates accordingly ? I've been through the strtotime and date functions, but trying to work out the "1 Friday", "last Thursday" etc seems tough, phew!
If anyone can give me a great way to do it, I'll be eternally grateful. :)
Many thanks for reading everyone,
Best Regards,
Paul
I've been going mad trying to solve this problem that I know php can do.
I have the option of either PHP4 or PHP5 on the server, so whichever is best, let me know. :o
All I am trying do is this; image several groups that meeting on certain days of the month:
e.g.
- Group 1 meets on the "1 Thursday" (first Thursday, I checked that PHP can work it out somehow using this format.
- Group 2 might meeting on the "last Friday" of the month.
I have all the data in a Mysql, have read it into an array from the db no problem with php, so take it at the simplest level without the db involved.
So here's a sample list of the groups and their "day of the months":
Group1 1 Thursday
Group2 3 Tuesday
Group3 First Thursday
Group4 1 Wednesday
Group5 3 Monday
Group6 Last Monday
Group7 2 Monday
Group8 2 Friday
Group9 2 Thursday
Group10 3 Wednesday
Group11 2 Wednesday
Group12 Last Friday
Note the "last" and "first" options in there. I have followed the php syntax as far as possible.
What bit of code will allow me to just whizz through, and work out the dates accordingly ? I've been through the strtotime and date functions, but trying to work out the "1 Friday", "last Thursday" etc seems tough, phew!
If anyone can give me a great way to do it, I'll be eternally grateful. :)
Many thanks for reading everyone,
Best Regards,
Paul