グーグルカレンダーAPIから
日本の祝日を取得して
一覧で表示する
<?php
$api_key = 'googleカレンダーAPIキー';
$holidays_id = 'japanese__ja@holiday.calendar.google.com';
$holidays_url = sprintf(
'https://www.googleapis.com/calendar/v3/calendars/%s/events?'.
'key=%s&timeMin=%s&timeMax=%s&maxResults=%d&orderBy=startTime&singleEvents=true',
$holidays_id,
$api_key,
$start_date,
$end_date,
30
);
if( $results = file_get_contents($holidays_url, true))
{
$results = json_decode($results);
$holidays = array();
foreach($results->items as $item)
{
$date = strtotime((string) $item->start->date);
$title = (string) $item->summary;
$holidays[date(‘Y-m-d’, $date)] = $title;
}
ksort($holidays);
}
https://jqueryui.com/datepicker/
とかと使えばよさげ
因みに休日は前後2年までしか取得できない模様
サンプルgoogleカレンダーAPI祝日