Ich habe hier ein PHP Code, der mir ausrechtet wie alt der Beitrag ist, also z.b 3 weeks ago. Meine Frage ist, kann man denn so anpassen, das er mir das herstellungs Datum und die Zeit anzeigt?
PHP-Code:
static function RelativeTime($timestamp){
//echo "Start : $timestamp<br>";
$difference = strtotime(date("Y-m-d H:i:s",time())) - $timestamp;
//echo "Diff : $difference<br>";
//exit;
$periods = array(
"DTDIFF_SEC",
"DTDIFF_MIN",
"DTDIFF_HOUR",
"DTDIFF_DAY",
"DTDIFF_WEEK",
"DTDIFF_MONTH",
"DTDIFF_YEAR",
"DTDIFF_DECADE"
);
$lengths = array("60","60","24","7","4.35","12","10");
//$difference /= 60;
//$difference /= 60;
//$difference /= 24;
if ($difference > 0) { // this was in the past
$ending = JText::_("DTDIFF_AGO");
} else { // this was in the future
$difference = -$difference;
$ending = JText::_("DTDIFF_TOGO");
}
Gruss
Einen Kommentar schreiben: