in reply to DateCalc using Date::Manip

The answer is likely the same as in Date Manip Delta_Format

Replies are listed 'Best First'.
Re^2: DateCalc using Date::Manip
by Krambambuli (Curate) on Jan 10, 2017 at 11:41 UTC
    Try

     print Delta_Format($dtopt,0,'+%yv:%Mv:+%wv:%dv:%hv:%mv:%sv');

    instead of your print line.

    It's probably not the newer Perl that bites you, but rather the newer Date::Manip module that you are using.
    Try to check what you have in Date::Manip::DM6.

    A bit strange; the raw value that I see for the delta calculated from the date values you provided is 0:0:0:110:0:0:0, which isn't equal with what your systems are giving.

      I have tried what you said and it gives me +0:0:+0:0:3648:0:0
        Try
        my $err; my $dtopt= DateCalc( $dt1 ,$dt2, \$err, 3);
        instead of your original code to do the calculation.
      I think depending upon o or 1 the output changes. I have now tried your same code and I get the same output as you. Many Thanks, T
Re^2: DateCalc using Date::Manip
by tsdesai (Acolyte) on Jan 10, 2017 at 11:33 UTC
    Hello, Thank you for the reply. I have tried the code as you suggested. Below is my modification to the code
    my $s2="2016080100:00:00"; my $e1="2016123100:00:00"; my $format = '%dh %hd %hh %ht %yd'; $duyx1 =(DateCalc($s2,$e1)); $duyx1 = Delta_Format($duyx1,'2',$format); print "\nduyx1 = $duyx1\n";
    The output that i get from the code above is 0.00 3648.00 3648.00 3648.00 0.00 But the actual output should be +0:0:+21:5:1:0:0 I am not sure what i missing . Really appreciate all your help. Many Thanks, Teju

      Note that your output string contains seven fields and colons between its values.

      Your $format string contains five placeholders and no colons between them.

      If you want identical values, a first step would be to specify the appropriate output format.

      Also, I think the %dh format is not a valid format specification for Date::Manip::DM5.