Subject: | strptime bug: %F unimplemented |
Date: | Wed, 14 Jun 2017 12:07:35 +0100 |
To: | bug-Time-Piece [...] rt.cpan.org |
From: | Ludovic Tolhurst-Cleaver <ludovic [...] bcs.org> |
Time::Piece (as noted in another bug report) claims to follow BSD's
strptime and strftime utilities, but it doesn't entirely.
%F is unimplemented. The BSD standard says that it should equate to
"%Y-%m-%d". Try the following two one-liners:
perl -MTime::Piece -E '$str = "2017-06-14"; my $t =
Time::Piece->strptime($str, "%F"); say $t'
perl -MTime::Piece -E '$str = "2017-06-14"; my $t =
Time::Piece->strptime($str, "%Y-%m-%d"); say $t'
The first warns "garbage at end of string in strptime: 2017-06-14" and sets
$t to Thu Jan 1 00:00:00 1970.
The second succeeds.
Please do implement %F !
Thanks.
--
Ludovic Tolhurst-Cleaver