<? echo(NAME_OF_CHURCH); ?> – Nächste Termine

– Nächste Termine

startDateForm: $startDateForm\n"); } $startDateCleaned = str_replace(" ", "", $startDateForm); // $startDateCleaned = str_replace(".", " ", $startDateForm); list($day, $month, $year) = explode(".", trim($startDateCleaned)); if(defined('DEBUG')) { echo("
startDateCleaned: $startDateCleaned
\n"); echo("
Day, Month, Year: $day, $month, $year
\n"); } if(isset($_GET['timeSpan'])) { $timeSpan = $_GET['timeSpan']; } else{ $timeSpan = "1week"; } if(defined('DEBUG')) { echo("
timeSpan: $timeSpan
\n"); } if($timeSpan == "1week"){ $timeSpanDays = 7; $mode = "weeks"; } elseif($timeSpan == "2weeks"){ $timeSpanDays = 14; $mode = "weeks"; } elseif($timeSpan == "3weeks"){ $timeSpanDays = 21; $mode = "weeks"; } elseif($timeSpan == "4weeks"){ $timeSpanDays = 28; $mode = "weeks"; } elseif($timeSpan == "16weeks"){ $timeSpanDays = 28*4; $mode = "weeks"; } elseif($timeSpan == "nextmonth" or $timeSpan == "afternextmonth"){ $mode = "months"; } else{ die("Unbekannte Angabe für timeSpan!"); } if(defined('DEBUG')) { echo("
mode: $mode
\n"); } if($mode == "weeks"){ $timeSpanSeconds = 3600 * 24 * $timeSpanDays; // print_r($dateParts); // echo("
" . $dateParts[1] . " " . $dateParts[2]); // $startDate = strptime($dateParts[1] . " " . $dateParts[2], " %e. %m"); // $startDate = mktime(0, 0, 0, $monthDE[$dateParts[2]], $dateParts[1], date("Y")); $startDate = mktime(0, 0, 0, $month, $day, $year); // echo("
Start: $startDate
"); // echo("
Start: ". strftime("%c", $startDate) . "
"); $startDateIcs = strftime("%Y%m%dT000000Z", $startDate); // echo("startDateIcs: ". $startDateIcs . "
"); $endDateIcs = strftime("%Y%m%dT235959Z", $startDate + $timeSpanSeconds); // echo("endDateIcs: ". $endDateIcs . "

"); // $startDMY = strftime("%d.%m.%Y", $startDate); $startDMY = strftime("%d. ", $startDate) . $monthNamesShort[(strftime("%m", $startDate)-1)*1] . strftime(". %Y", $startDate); // $endDMY = strftime("%d.%m.%Y", $startDate + $timeSpanSeconds); $endDMY = strftime("%d. ", $startDate + $timeSpanSeconds) . $monthNamesShort[(strftime("%m", $startDate + $timeSpanSeconds)-1)*1] . strftime(". %Y", $startDate + $timeSpanSeconds); $startDayFormated = strftime("%e.", $startDate); // $startMonthFormated = $monthNamesShort[(strftime("%m", $startDate)-1)*1] . "."; $startMonthFormated = $monthNames[(strftime("%m", $startDate)-1)*1]; $startYearFormated = strftime("%Y", $startDate); $endDayFormated = strftime("%e.", $startDate + $timeSpanSeconds); // $endMonthFormated = $monthNamesShort[(strftime("%m", $startDate + $timeSpanSeconds)-1)*1] . "."; $endMonthFormated = $monthNames[(strftime("%m", $startDate + $timeSpanSeconds)-1)*1]; $endYearFormated = strftime("%Y", $startDate + $timeSpanSeconds); if ($startMonthFormated == $endMonthFormated) { # Start and end in same month $formatedDateSpan = "$startDayFormated – $endDayFormated $endMonthFormated $endYearFormated"; } else if (($startDayFormated != $endDayFormated) && ($startYearFormated == $endYearFormated)) { // Start and end not in same month but same year $formatedDateSpan = "$startDayFormated $startMonthFormated – $endDayFormated $endMonthFormated $endYearFormated"; } else { # Start and end not in same year $formatedDateSpan = "$startDayFormated $startMonthFormated $startYearFormated – $endDayFormated $endMonthFormated $endYearFormated"; } if(defined('DEBUG')) { // echo("
Month: -" . $dateParts[2] . "- => " . $monthDE[$dateParts[2]] . "
\n"); echo("
startDMY: $startDMY
\n"); echo("
mktime(0, 0, 0, $month, $day, $year);
\n"); echo("
endDMY: $endDMY
\n"); } } else{ //months $firstDayOfCurrentMonth = date("Y-m-01"); //2017-07-01 // $firstDayOfCurrentMonth = date("2016-12-1"); //test // $firstDayOfCurrentMonth = date("2017-1-1"); //test // $firstDayOfCurrentMonth = date("2017-2-1"); //test if($timeSpan == "nextmonth"){ $firstOfMonth = strtotime ( '+1 month' , strtotime ( $firstDayOfCurrentMonth ) ) ; } else{ //after next month $firstOfMonth = strtotime ( '+2 month' , strtotime ( $firstDayOfCurrentMonth ) ) ; } $lastDayOfMonth = strtotime ( '+1 month' , $firstOfMonth) - 1; //first day of next month minus 1 second $startDateIcs = strftime("%Y%m%dT000000Z", $firstOfMonth); $endDateIcs = strftime("%Y%m%dT235959Z", $lastDayOfMonth); $monthNo = strftime("%m", $firstOfMonth); $month = $monthNames[$monthNo-1]; $year = strftime("%Y", $firstOfMonth); if(defined('DEBUG')) { echo("
startDateIcs: $startDateIcs ($firstOfMonth)
"); echo("
endDateIcs:  $endDateIcs ($lastDayOfMonth)
"); echo("
firstOfMonth:  $firstOfMonth ($monthNo)
"); } } ?>
Nächster Sonntag







Quelle:
Support: george[at]ruinelli.ch