Created
January 26, 2011 07:38
-
-
Save co3k/796377 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
<?php | |
require_once 'Calendar/Month.php'; | |
require_once 'Date/Holidays.php'; | |
if (isset($argv[1])) { | |
$month = $argv[1]; | |
} else { | |
$month = date('Ym'); | |
} | |
$tejimayaSpecial = array( | |
// nenshi | |
'20110101', '20110102', '20110103', '20110104', | |
); | |
$target = strtotime($month.'01'); | |
$cal = new Calendar_Month(date('Y', $target), date('m', $target)); | |
$cal->build(); | |
$days = $cal->fetchAll(); | |
$dh = @Date_Holidays::factory('Japan', date('Y', $target), 'ja_JP'); | |
$eigyobiCount = 0; | |
foreach ($days as $i => $day) { | |
$ts = $day->getTimestamp(); | |
$w = date('l', $ts); | |
if ('Saturday' === $w || 'Sunday' === $w) { | |
continue; | |
} | |
if ($dh->isHoliday($day->getTimestamp())) { | |
continue; | |
} | |
if (in_array(date('Ymd', $ts), $tejimayaSpecial)) { | |
continue; | |
} | |
$eigyobiCount += 1; | |
} | |
?> | |
営業日 : <?php echo $eigyobiCount.' 日'.PHP_EOL; ?> | |
「しかるべき時間」: <?php echo ($eigyobiCount * 8).' 時間'.PHP_EOL; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment