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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.