From: Moritz Bunkus Date: Mon, 15 Feb 2010 09:08:47 +0000 (+0100) Subject: Funktion zur Datumsformartierung für Tripel-Form $yy, $mm, $dd X-Git-Tag: release-2.6.2beta1~249 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b32553a3c1bf57303b430d0c68e21fdff854999c;p=kivitendo-erp.git Funktion zur Datumsformartierung für Tripel-Form $yy, $mm, $dd --- diff --git a/SL/Locale.pm b/SL/Locale.pm index 172155e46..066808123 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -398,6 +398,23 @@ sub reformat_date { return $output_format; } +sub format_date { + $main::lxdebug->enter_sub(); + + my ($self, $myconfig, $yy, $mm, $dd) = @_; + + $main::lxdebug->leave_sub() and return "" unless $yy && $mm && $dd; + + my $format = $myconfig->{dateformat}; + $format =~ s{ d+ }{ sprintf("%0" . (length($&)) . "d", $dd) }gex; + $format =~ s{ m+ }{ sprintf("%0" . (length($&)) . "d", $mm) }gex; + $format =~ s{ y+ }{ sprintf("%4d", $yy) }gex; + + $main::lxdebug->leave_sub(); + + return $format; +} + sub quote_special_chars { my $self = shift; my $format = lc shift;