From b32553a3c1bf57303b430d0c68e21fdff854999c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 15 Feb 2010 10:08:47 +0100 Subject: [PATCH] =?utf8?q?Funktion=20zur=20Datumsformartierung=20f=C3=BCr?= =?utf8?q?=20Tripel-Form=20$yy,=20$mm,=20$dd?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Locale.pm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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; -- 2.20.1