Re: Last working day of a month

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



you need a process with a few simple steps.

1. find the last day of the month, this is quite easy ... google gives answers
as does the manual. e.g.:

http://lutrov.com/blog/php-last-day-of-the-month-calculation/

2. determine if this is a week day. if yes go to step three else 'roll the date back'
24 hours and go to step 2.

3. determine if this is a holiday, if yes 'roll the date back' 24 hours and go
to step 2. else you have found the last working day of the month.

with regard to determining if a day is a holiday your best bet is to store these in a database table. and check against that ... you may be able to find a source of holiday data online from which you can sync your local datasource periodically
(e.g. via a cron job).

hth

Well it should!! The advice I love most of all is like this, helping me see the clear logic, and then letting me figure out how to write it w/the language at hand. This reply post of mine does not add anything for anyone; sometimes I just can't help express my appreciation for things. Brilliant Jochem!
-G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux