diff options
| author | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2023-03-27 20:37:13 +0200 |
|---|---|---|
| committer | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2023-04-19 17:15:35 +0200 |
| commit | a3eb071a6c6b14e66f413c1cab3a6cbe76a6cfe3 (patch) | |
| tree | 77ab5c007a66f61bfb04b78dcd3eb5343bcc3cd9 /challenge-038 | |
| parent | 570d93fd5c566075161b7d0627893eec68dc1d38 (diff) | |
| download | perlweeklychallenge-club-a3eb071a6c6b14e66f413c1cab3a6cbe76a6cfe3.tar.gz perlweeklychallenge-club-a3eb071a6c6b14e66f413c1cab3a6cbe76a6cfe3.tar.bz2 perlweeklychallenge-club-a3eb071a6c6b14e66f413c1cab3a6cbe76a6cfe3.zip | |
Challenge 038 task 1
Diffstat (limited to 'challenge-038')
| -rwxr-xr-x | challenge-038/jo-37/perl/ch-1.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-038/jo-37/perl/ch-1.pl b/challenge-038/jo-37/perl/ch-1.pl new file mode 100755 index 0000000000..c4bd403559 --- /dev/null +++ b/challenge-038/jo-37/perl/ch-1.pl @@ -0,0 +1,11 @@ +#!/usr/bin/perl + +use v5.16; +use warnings; +use DateTime::Format::Strptime; + +my $dt = DateTime::Format::Strptime->new(pattern => '%Y%m%d', strict => 1) + ->parse_datetime(shift =~ s/^([12])/20 - ($1 > 1)/er); +$dt && say DateTime::Format::Strptime->new(pattern => '%Y-%m-%d') + ->format_datetime($dt); + |
