Revision 8484285f
Von Moritz Bunkus vor mehr als 14 Jahren hinzugefügt
SL/Locale.pm | ||
---|---|---|
401 | 401 |
sub format_date { |
402 | 402 |
$main::lxdebug->enter_sub(); |
403 | 403 |
|
404 |
my ($self, $myconfig, $yy, $mm, $dd) = @_; |
|
404 |
my $self = shift; |
|
405 |
my $myconfig = shift; |
|
406 |
my $yy = shift; |
|
407 |
my $mm = shift; |
|
408 |
my $dd = shift; |
|
409 |
my $yy_len = shift || 4; |
|
405 | 410 |
|
406 | 411 |
$main::lxdebug->leave_sub() and return "" unless $yy && $mm && $dd; |
407 | 412 |
|
408 |
my $format = $myconfig->{dateformat}; |
|
413 |
$yy = $yy % 100 if 2 == $yy_len; |
|
414 |
|
|
415 |
my $format = ref $myconfig eq '' ? "$myconfig" : $myconfig->{dateformat}; |
|
409 | 416 |
$format =~ s{ d+ }{ sprintf("%0" . (length($&)) . "d", $dd) }gex; |
410 | 417 |
$format =~ s{ m+ }{ sprintf("%0" . (length($&)) . "d", $mm) }gex; |
411 |
$format =~ s{ y+ }{ sprintf("%4d", $yy) }gex;
|
|
418 |
$format =~ s{ y+ }{ sprintf("%0${yy_len}d", $yy) }gex;
|
|
412 | 419 |
|
413 | 420 |
$main::lxdebug->leave_sub(); |
414 | 421 |
|
Auch abrufbar als: Unified diff
Datum formatieren: Optional Länge des Jahresfeldes angeben