Kurzmeldung Info

Neue Homepage

Ab 2015 gibts neue Beiträge nur noch hier! Neues responsible Design. Aus Mambo wird jetzt Joomla.
Hier gibts meinen Php-code. Powered by FH-Worms
Datum check PHP PDF Drucken E-Mail
Bewertung:  Stimmen: 3/Sterne: 5
SchlechtSehr gut 
Verfasst von
Das phpscript zeigt ein regelmässig wiederkehrendes Datum an

Ja, ich weiss, das PHP-Script das immer den 2.Donnerstag im Monat anzeigt ist noch nicht perfekt. Es wird wohl zum Jahreswechsel falsch anzeigen, aber sonst erfüllt es seinen Zweck. Verbesserungen sind willkommen. Vielleicht bau ich ja noch mal dran rum. Mit den rot gekennzeichneten Zusätzen soll jetzt der Jahreswechsel auch funktionieren.
Jahreswechsel approved: Stefan Höhn 01.01.2012 .
 
<?php
/**
   *
   *  Gets the first weekday of that month and year
   *
   *  @param  int   The day of the week (0 = sunday, 1 = monday ... , 6 = saturday)
   *  @param  int   The month (if false use the current month)
   *  @param  int   The year (if false use the current year)
   *
   *  @return int   The timestamp of the first day of that month
   *
   **/ 
function get_first_day($day_number=1$month=false$year=false)
{
$month=($month === false) ? strftime("%m"): $month;
$year=($year === false) ? strftime("%Y"): $year;
$first_day + ((7+$day_number strftime("%w"mktime(0,0,0,$month1$year)))%7);
return 
mktime(0,0,0,$month$first_day$year);
}
$monat=date("m");
$jahr=date("y");// $datum_live = date("d,m,y");
// $datum_termin=strftime("%d-%m-%Y", get_first_day(4, $monat));
// echo "datum_live =".$datum_live."datum_termin=".$datum_termin;$tages_differenz = date("d")-strftime("%d", get_first_day(4, $monat));// echo $tages_differenz;if ($tages_differenz > 0){
$monat $monat 1;
}if (
$monat 12){
$monat 1;
$jahr $jahr +1;}
// this will output the 2. Donnerstag of 
// aktuelles Monat und Jahr(wed 03-01-2007)echo "Donnerstag ".strftime("%d-%m-%Y", get_first_day(4, $monat , $jahr));
// Script ist hier zu Ende.
?>

Mach damit was du willst.
Letzte Aktualisierung ( 14.02.2014 )
Gemacht von Stefan Höhn als ; Publisher und Mambo.
Mambo ist freie Software herausgegeben unter GNU/GPL Lizenz.