-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
29 lines (22 loc) · 958 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
// Date Frequency Calculator and Public Holiday Checker
// By Tom Kavanagh https://github.com/tkav/php-date-frequency
include('src/datefrequency.php');
//3 months from date
$nextOccurrence = DateFrequency::nextOccurrence('08-05-2018', '3', 'months');
echo '<br>'.$nextOccurrence;
//3 months from date and the preferred day of the month
$nextOccurrence = DateFrequency::nextOccurrence('08-05-2018', '3', 'months', 'third wednesday');
echo '<br>'.$nextOccurrence;
//custom format
$nextOccurrence = DateFrequency::nextOccurrence('08-05-2018', '3', 'months', 'third wednesday', 'Ymd');
echo '<br>'.$nextOccurrence;
//check if date is a public holiday
$isholiday = publicHoliday::isHoliday('13-12-2018');
echo '<br>'.$isholiday;
$isholiday = publicHoliday::isHoliday('25-12-2018');
echo '<br>'.$isholiday;
//get name of public holiday
$holidayName = publicHoliday::holidayName('25-12-2018');
echo '<br>'.$holidayName;
?>