RE: [PHP] PHP and Date()
| From: | Jay Blanchard | Date: | Thu, 18 Jul 2002 16:29:18 +0000 |
| Subject: | RE: [PHP] PHP and Date() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108286@lists.php.net to get a copy of this message | ||
[snip]
How can I look back Business Days.
I would like to go back from a certain date, like 7 business days. Is there
a simple way other then looping and checking for the day of the week?
[/snip]
$sevendaysago = date("Y-m-d", mktime(date("h")-168));
This will give you the date exactly seven days ago, then you can test what
day (Mon - Fri). If it is Saturday then you could subtract 24 more hours, if
Sunday, 48 more hours.
HTH!
Jay
"Of all the things Ive lost, I miss my mind the most"
*************************************
* Want to meet other PHP developers *
* in your area? Check out: *
* http://php.meetup.com/ *
* No developer is an island ... *
*************************************