RE: [PHP] Last working day of a month
- From: tmboyd1@xxxxxxxx ("Boyd, Todd M.")
- Date: Thu, 4 Dec 2008 08:51:14 -0600
-----Original Message-----
From: Andrew Ballard [mailto:aballard@xxxxxxxxx]
Sent: Thursday, December 04, 2008 8:32 AM
To: Angelo Zanetti
Cc: php-general@xxxxxxxxxxxxx
Subject: Re: [PHP] Last working day of a month
Importance: Low
On Thu, Dec 4, 2008 at 9:03 AM, Angelo Zanetti <angelo@xxxxxxxxxxxxxxx>
wrote:
Hi all,month.
I am busy trying to figure out how to get the last working day in a
what I
I was wondering if there was a script already written, but this is
imagine should work:true
Get the current day and see if it's the last day of the month. If its
check if it's a Saturday or Sunday if it's either of those 2 daysthen
return false else return true?best
I also need to take public holidays into account. What would be the
solution for that? Store the public holidays in a table and check ifthe
current day isn't a public holiday?
If your application is already using a database, I would use a date
table rather than a holiday table. You can add columns to indicate
whether each date is a workday, weekday, weekend, holiday, or any
other date category/group that you need to track.
That seems like a waste of space and database calls to me. (Yes, I know space is cheap... but it should at least be thought about briefly. Using that space costs cycles, etc.) Since the exceptions to his rule are so few in comparison to the days that follow, I think documenting the exceptions and assuming it's a workday if it's not an exception makes more sense (IMHO).
I'd probably store all holidays in a table and assume that Saturdays/Sundays are not workdays unless they have a corresponding entry in the same table that holds the holidays. Call the table "exceptions." The exception to a workday is a holiday. The exception to a weekend is a workday. :)
HTH,
// Todd
- References:
- Last working day of a month
- From: "Angelo Zanetti"
- Re: [PHP] Last working day of a month
- From: "Andrew Ballard"
- Last working day of a month
- Prev by Date: RE: [PHP] How to fetch .DOC or .DOCX file in php
- Next by Date: Re: [PHP] Last working day of a month
- Previous by thread: Re: [PHP] Last working day of a month
- Next by thread: Re: [PHP] Last working day of a month
- Index(es):
Relevant Pages
|