Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
andrejsstepanovs committed Jan 6, 2015
1 parent 19cc42e commit 09e50fb
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,33 @@ Business Days Calculator
"andrejsstepanovs/business-days-calculator": "dev-master",
}

# Examples

use \BusinessDays\Calculator;

$holidays = [
new \DateTime('2000-12-31'),
new \DateTime('2001-01-01')
];

$freeDays = [
new \DateTime('2000-12-28')
];

$freeWeekDays = [
Calculator::SATURDAY,
Calculator::SUNDAY
];

$calculator = new Calculator();
$calculator->setStartDate(new \DateTime('2000-12-27'));
$calculator->setFreeWeekDays($freeWeekDays); // repeat every week
$calculator->setHolidays($holidays); // repeat every year
$calculator->setFreeDays($freeDays); // don't repeat

$calculator->addBusinessDays(3); // add X working days

$result = $calculator->getDate(); // \DateTime
echo $result->format('Y-m-d'); // 2001-01-03
# Example

``` php
use \BusinessDays\Calculator;

$holidays = [
new \DateTime('2000-12-31'),
new \DateTime('2001-01-01')
];

$freeDays = [
new \DateTime('2000-12-28')
];

$freeWeekDays = [
Calculator::SATURDAY,
Calculator::SUNDAY
];

$calculator = new Calculator();
$calculator->setStartDate(new \DateTime('2000-12-27'));
$calculator->setFreeWeekDays($freeWeekDays); // repeat every week
$calculator->setHolidays($holidays); // repeat every year
$calculator->setFreeDays($freeDays); // don't repeat

$calculator->addBusinessDays(3); // add X working days

$result = $calculator->getDate(); // \DateTime
echo $result->format('Y-m-d'); // 2001-01-03
```

0 comments on commit 09e50fb

Please sign in to comment.