Im using this also now, in german:
my $added = GT::Date::date_get($_[0]);
my $old = GT::Date::date_diff(GT::Date::date_get(), $added);
my $output;
if ($old == 0 ) {
$output = "heute";
}
elsif ( int ($old / 7) > 0 && int ($old / 7) < 4 ) {
my $weeks = int ($old / 7);
$output = $weeks == 1 ? "Woche" : $weeks . " Wochen";
}
elsif ( $old < 30 ) {
$output = $old == 1 ? " gestern" : $old . " Tagen";
}
elsif ( $old < 365 ) {
my $months = int ($old / 30 );
$output = $months == 1 ? "Monat" : $months . " Monaten";
}
else {
my $years = int ($old / 365 );
$output = $years == 1 ? "Jahr" : $years . " Jahren";
}
return $output;
}
call it with:
___________________________________________
http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de
Code:
sub { my $added = GT::Date::date_get($_[0]);
my $old = GT::Date::date_diff(GT::Date::date_get(), $added);
my $output;
if ($old == 0 ) {
$output = "heute";
}
elsif ( int ($old / 7) > 0 && int ($old / 7) < 4 ) {
my $weeks = int ($old / 7);
$output = $weeks == 1 ? "Woche" : $weeks . " Wochen";
}
elsif ( $old < 30 ) {
$output = $old == 1 ? " gestern" : $old . " Tagen";
}
elsif ( $old < 365 ) {
my $months = int ($old / 30 );
$output = $months == 1 ? "Monat" : $months . " Monaten";
}
else {
my $years = int ($old / 365 );
$output = $years == 1 ? "Jahr" : $years . " Jahren";
}
return $output;
}
call it with:
Code:
Eingetragen seit <%link_age($Add_Date_time)%>http://www.westalgarve.de
http://www.portugalforum.org
http://www.portugal-links.de