20231024.020045
Ah, I see you're a person of culture as well! To be sure, is that date-time in "YYYYMMDD.HMnS" (see Date::Manip::Date) or "%Y%m%d.%H%M%S" format? If not, rest of it is useless.
I did not find in Date::Manip::Date documentation anything matching your example. OTOH 20231024 is parsed to date of Oct 24, 2023 as expected.
I also did not see a way, perhaps missed, to convert the return value of Date::Manip::Date->parse_format( q[%Y%m%D\.%H%M%S], q[20231024.020045] ) into Date::Manip::Obj.
# date-manip.pl use strict; use warnings; use feature qw[ signatures ]; use Data::Dumper qw[ Dumper ]; use Date::Manip::Date; my @date_maybe = ( q[20231024.020045], q[20231024] ); for my $input ( @date_maybe ) { my $parsed = Date::Manip::Date->new( $input ); show( $input, $parsed ); } my $parser = Date::Manip::Date->new(); my ( $err, %matched ) = $parser->parse_format( q[%Y%m%d\.%H%M%S], $dat +e_maybe[0] ); print Dumper( [ $err, \%matched ] ); exit; sub show( $input, $parsed ) { if ( my $err = $parsed->err() ) { warn qq[Error during parsing $input: $err\n]; } my $cooked = $parsed->value(); print qq[$input was parsed to $cooked\n]; # Too long of a dump. #print Dumper( $parsed ); }
perl5.34.1 date-manip.pl The signatures feature is experimental at date-manip.pl line 26. 20231024.020045 was parsed to 2024062217:53:11 20231024 was parsed to 2023102400:00:00 $VAR1 = [ 0, { 'y' => '2023', 's' => '45', 'mn' => '00', 'h' => '02', 'm' => '10', 'd' => '24' } ];
In reply to Re: Date::Manip returns wrong value
by Anonymous Monk
in thread Date::Manip returns wrong value
by expo1967
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |