Today Yesterday Hack
Verfasst: 27.07.2005 10:01
Wo finde ich denn den lft erwähnten Today Yesterday MOD der mir das Datum durch die Tagesangabe ersetzt?
phpBB.de - Die deutsche phpBB-Community
https://www.phpbb.de/community/
Code: Alles auswählen
$thetime = ( !empty($translate) ) ? strtr(@gmdate($format, $gmepoch + (3600 * $tz)), $translate) : @gmdate($format, $gmepoch + (3600 * $tz));
$L_heute = 'Heute';
$L_gestern = 'Gestern';
$time_format = " H:i";
$date = getdate();
$heute = $date['mday'];
$monat = $date['mon'];
$year = $date['year'];
$forum_date_heute = @gmdate ("d", $gmepoch);
$forum_date_monat = @gmdate ("m", $gmepoch);
$forum_date_year = @gmdate ("Y", $gmepoch);
if ($forum_date_heute == $heute && $forum_date_monat == $monat && $forum_date_year == $year)
$thetime = $L_heute . @gmdate ($time_format, $gmepoch);//heute
else
if ($heute != 1 && $forum_date_heute == ($heute-1) && $forum_date_monat == $monat && $forum_date_year == $year)
$thetime = $L_gestern . @gmdate ($time_format, $gmepoch);//gestern
else
//if heute is 1 and the monat is not 1, then we have to check how many days in the previews monat
//and then set $gestern to the last day in the previews monat
if ($heute == 1 && $monat != 1)
{
$gestern = date ("t", mktime(0,0,0,($monat-1),1,$year));//returns how many days in the previews monat
if ($forum_date_heute == $gestern && $forum_date_monat == ($monat-1) && $forum_date_year == $year)
$thetime = $L_gestern . @gmdate ($time_format, $gmepoch);//gestern
}
else
//if we are in the first day in the year
if ($heute == 1 && $monat == 1)
{
$gestern = date ("t", mktime(0,0,0,12,1,($year -1)));
if ($forum_date_heute == $gestern && $forum_date_monat == 12 && $forum_date_year == ($year-1))
$thetime = $L_gestern . @gmdate ($time_format, $gmepoch);//gestern
}
return ($thetime);