note 13846 added to function.date.php

From: Date: Thu, 05 Jul 2001 22:15:02 +0000
Subject: note 13846 added to function.date.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15022@lists.php.net to get a copy of this message
Hey guys... I just wrote this little script to find the last 5 business days... here it is: $businessDate[today] = date("Y-m-d"); $day = 1; for($i = 1; $i <= 5; $i++) { $useMe = "day" . $i; while(!$businessDate[$useMe]) { $time = mktime (0,0,0,date("m"), date("d")-$day ,date("Y")); $dayOfWeek = date("w", $time); if($dayOfWeek != 0 && $dayOfWeek != 6) { $businessDate[$useMe] = date("Y-m-d", $time); } $day++; } } so $businessDate[today] is today's date, $businessDate[day1] was yesterday... etc... Enjoy.. --DeionXxX www.tbacentral.com http://www.php.net/manual/en/function.date.php

« previous php.notes (#15022) next »