Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Determining how many mondays in a month

0 views
Skip to first unread message

degrit

unread,
Jun 15, 2003, 3:35:45 PM6/15/03
to
Hello,
I'm newish to php and I believe there are many useful functions I have
no idea of.
I am writing some code to find and display recurrencies stored in a
mysql db, given the conditions and a starting date, within a given
range.
e.g., 'every 2nd monday of the month', 'every tuesday and friday of
the third week of the month' etc.

If I was to say, for example, that the start date is 01.01.2003, and
the condition is 'every first monday of the month', I should calculate
all the next occurrencies of that item from 01.01.2003, and display
them if within the given range of dates.

Is there any function in php which tells me, given a date, what day of
the month it is (2nd, 5th, 23rd, etc.), and if it's a monday, tuesday,
etc., or even which week it is (1st, 2nd, 3rd etc.) ?

Thanks

Tony Marston

unread,
Jun 15, 2003, 4:52:53 PM6/15/03
to
take a look at http://uk2.php.net/manual/en/function.date.php and check out
the 'D' format character.

Tony Marston

"degrit" <death_...@hotmail.com> wrote in message
news:b01a7ee2.03061...@posting.google.com...

PII...@home.nl

unread,
Jun 15, 2003, 5:00:12 PM6/15/03
to
On 15 Jun 2003 12:35:45 -0700, death_...@hotmail.com (degrit)
wrote:

Is the function
NWeekdayOfMonth($occurance,$dayOfWeek,$month,$year,$format="%Y%m%d")
of the date_calc class http://www.phpinsider.com/php/code/Date_Calc/
the thing you're looking for?


0 new messages