thanks all It's common for us to overthink the complexity of date/time calculations and underthink the power and flexibility of PHP's built-in functions.
Consider Since PHP 5.6.23 en 7.0.8 the support for requesting the weeknumber for a given date, where the first day of the week is Sunday, has been removed.
An example of this relates to a comment made by james at bandit-dot-co-dot-en-zed.
Monday-Friday, excluding holidays) between any two given dates.
The function could certainly be made much more powerful, to allow you to set different days to be ignored (e.g.
"skip all Fridays and Saturdays but include Sundays") or to set up dates that should always be skipped (e.g.
Rather than using mktime() and a loop, James can subtract the current timestamp from the timestamp of the date in question and divide that by the number of seconds in a day: Another usage could find itself in a class submitted by Kyle M Hall which aids in the creation of timestamps from the recent past for use with My SQL.
Rather than the looping and fine tuning of a date, Kyle can use the raw UNIX timestamps (this is untested code): While this will work for the majority of years it will not work on years that are multiples of 100 but not multiples of 400 i.e.(2100).