Created
November 3, 2024 09:27
-
-
Save ernstki/7e60edfd2156a7ad2bfcbbe47de4ed4f to your computer and use it in GitHub Desktop.
Convert wacky date formats into ISO 8601 YYYY-MM-DD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.12; | |
use Time::Piece; | |
sub isoize { | |
# convert any wacky date formats to ISO 8601 | |
my @dates; | |
foreach (@_) { | |
push @dates, Time::Piece->strptime($_, '%d %b %Y') if /\d+ \w+ \d{4}/; | |
# other date formats here | |
} | |
return map { $_->strftime('%F') } @dates; | |
} | |
main() unless caller(); | |
sub main { | |
# whatever, maybe parse command-line options | |
undef; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment