Thanks guys I am aware of the leap year but I did not want to further confuse myself so for now I am just trying to ease myself in to understanding. I added this sub routine but it only keeps 365 so even if put a date of 2 years e.g. 1-jan-2000 to 1-jan-2002 it still only gives 365 as the number of days.

sub isFullYear{ my$startDay=shift; my$endDay=shift; my$sMon=shift; my$eMon=shift; my$fullYear; if ( NumberOfDaysBetween($startDay,$endDay ,$endDay,$eMon) == 365){ $fullYear=365; } return $fullYear; }

this is the call for the sub in the main

my$years= ($cy-$y) * isFullYear($d,$cd ,$m,$cm); $days= $days + NumberOfDaysBetween($d,31,$m,12) + NumberOfDaysBetween( +1,$cd,1,$cm) + $years; print "$days";

In reply to Re^2: perl basic count days between two dates by scripter87
in thread perl basic count days between two dates by scripter87

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.