[thelist] PHP Dates Dilemma

Burhan Khalid burhankhalid at members.evolt.org
Wed Apr 17 17:02:01 CDT 2002


rudy wrote:
>>What I would like to do is pragmatically figure out the dates
>>that correspond to each Tuesday and Thursday of the month
>
>
> hi burhan
>
> could you be a bit more specific?  presumably you want only the remaining
> tuesdays and thursdays of the current month, since tuesdays and thursdays
> that have already gone by would not be good to sign up for, right?  and
> what about if today is the 31st, don't you want a few tuesdays and
> thursdays of the following month?

Sure (Specifics) :

	What I want to be able to do is, when I first initialize the program
(script), it should, from the current date, populate a table with all
available Tuesdays and Thursdays, given a range. So, say today is
Wednesday. It should, take this information, plus the given range, get
the dates for all Tuesdays and Thursdays and stick em in a table. For
example, from Today till August 30th, find all Tuesdays and Thursdays,
and insert them into table tutoring_dates. That's what I would like to
be able to do. I need this delimiter because I want the end user to be
able to say -- okay -- configure the script for the Fall Semester, and
the program would know (more than likely, get off the net), the ending
day of the fall semester, and then populate the tutoring_dates table
with all Tuesdays and Thursdays from the date that the script has been
executed. Once the script is done populating the table, I would lock it.

	One thought (that just occured to me), was that I could just step through
the dates till my terminating date, checking each one to see if it was a
tuesday or thursday. If it is, then push it into an array. At the end of
the loop, step through that array and stick the dates into a table.
Seems to me that there has got to be a better way to it than my
brute-force method.

	Your mySQL query kinda went over my head on the first run through it
(goes to show that I need to get back into the ol mySQL manual).
However, I will peruse it and ask you questions offlist (if that's
okay), if (more than likely when) I can't get it to go.

>
> anyhow, here's how i would approach it

[ snip some interesting voodoo mySQL stuff ]




More information about the thelist mailing list