Revision 3edbebcc
Von Moritz Bunkus vor etwa 18 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
2546 | 2546 |
return ($yy, $mm, $dd); |
2547 | 2547 |
} |
2548 | 2548 |
|
2549 |
sub reformat_date { |
|
2550 |
$main::lxdebug->enter_sub(); |
|
2551 |
|
|
2552 |
my ($self, $myconfig, $date, $output_format, $longformat) = @_; |
|
2553 |
|
|
2554 |
$main::lxdebug->leave_sub() and return "" unless ($date); |
|
2555 |
|
|
2556 |
my ($yy, $mm, $dd) = $self->parse_date($myconfig, $date); |
|
2557 |
|
|
2558 |
$output_format =~ /d+/; |
|
2559 |
substr($output_format, $-[0], $+[0] - $-[0]) = |
|
2560 |
sprintf("%0" . (length($&)) . "d", $dd); |
|
2561 |
|
|
2562 |
$output_format =~ /m+/; |
|
2563 |
substr($output_format, $-[0], $+[0] - $-[0]) = |
|
2564 |
sprintf("%0" . (length($&)) . "d", $mm); |
|
2565 |
|
|
2566 |
$output_format =~ /y+/; |
|
2567 |
if (length($&) == 2) { |
|
2568 |
$yy -= $yy >= 2000 ? 2000 : 1900; |
|
2569 |
} |
|
2570 |
substr($output_format, $-[0], $+[0] - $-[0]) = |
|
2571 |
sprintf("%0" . (length($&)) . "d", $yy); |
|
2572 |
|
|
2573 |
$main::lxdebug->leave_sub(); |
|
2574 |
|
|
2575 |
return $output_format; |
|
2576 |
} |
|
2577 |
|
|
2549 | 2578 |
1; |
Auch abrufbar als: Unified diff
Funktion in Locale implementiert, um ein Datum in einem anderen Format auszugeben.