从日期数组中获取日期名称

时间:2016-04-14 15:53:55

标签: php

我在给定的日期数组中过滤假期,如下所示:

date_default_timezone_set('Europe/Berlin');

$timestamp = strtotime('monday this week');
$holidays = array('Sonntag 17.04.','Dienstag 19.04.','Mittwoch 20.04.');

$days = array();
for ($i = 0; $i < 14; $i++) :
 $days[] = strftime('%A %d.%m.', $timestamp);
 $timestamp = strtotime('+1 day', $timestamp);
endfor;

foreach($days AS $day) :
if (in_array($day, $holidays)) :
echo $day . ' is a holiday and ' . (strftime('%A', strtotime($day))) . '<br />';
else :
echo $day . '<br />';
endif;
endforeach;

现在我也希望得到这样的一天的名字:

&#34;星期二19.04。是假期和周二&#34;

我怎么能做到这一点?

1 个答案:

答案 0 :(得分:0)

<?php
$areas = json_decode($_POST['points'], true);
?>
<script>
    var map = document.getElementById('interactiveWorkstation');
    var area = document.getElementById('<?php echo $deviceName; ?>');
    if(!area)
        map.insertAdjacentHTML('beforeend', '<area id="<?php echo $deviceName; ?>" shape="polygon" coords="<?php echo $areas[$deviceName]; ?>" href=\'javascript:createTerminal(<?php echo "\"".$deviceName."\""; ?>, <?php echo "\"".$deviceIp; ?>-<?php echo $randomKey."\""; ?>, <?php echo "\"".$uid."\""; ?>, <?php echo "\"".$deviceName."\""; ?>);\'/>');
</script>