Created
February 12, 2013 17:04
-
-
Save jblac/4771375 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public $ourDate; | |
public function _getLastBusinessDay() { | |
// lets figure out the business days.. | |
$holidayList = array('2013-02-06'); | |
$this->ourDate = date('Y-m-d', strtotime('-5 weekdays')); | |
foreach ($holidayList as $holiday) { | |
$timestamp = strtotime($holiday);// holiday lists.. | |
$tmp = strtotime($this->ourDate); // todays date - 5 weekdays | |
$tmp1 = strtotime(date('Y-m-d')); // todays date | |
if ($tmp <= $timestamp && $timestamp <= $tmp1 && date("N", $timestamp) != 6 && date("N", $timestamp) != 7) { | |
$this->ourDate = date('Y-m-d', strtotime('-1 weekday', strtotime($this->ourDate))); | |
} | |
} | |
return $this->ourDate; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment