Dear Monks,

I have mentioned the below code i tried using Date::Calc module. I have to get the input From date, To date and Hours from the user. I have to distribute the Hours with in the From date and To date i have given. Allocate 8hrs. for each date. Remaining hrs. to be mentioned at last as remainder. I have omit the holidays as mentioned in Date::Calc holidays. Please give me any idea or code.

Thanks in advance.

#!/usr/bin/perl #INPUT : 17 December 2001 to 16 June 2002 use strict; use Date::Calc qw( :all ); my ($fdate,$tdate,$day,$month,$year,$tday,$tmonth,$tyear,$i,$j,$hour); my (@start,@stop,@date); print "Enter the From Date: "; chomp($fdate = <STDIN>); print "Enter the To Date: "; chomp($tdate = <STDIN>); print "Enter the Total hours: "; chomp($hour = <STDIN>); ($day,$month,$year)=split(" ", $fdate); ($tday,$tmonth,$tyear)=split(" ", $tdate); $month = Decode_Month($month); $tmonth = Decode_Month($tmonth); if (Date_to_Days($year,$month,$day) > Date_to_Days($tyear,$tmonth,$tday)) { print "\nThe From date should less than To Date\n"; } else { @start = ($year,$month,$day); @stop = ($tyear,$tmonth,$tday); $j = Delta_Days(@start,@stop); for ( $i = 0; $i <= $j; $i++ ) { @date = Add_Delta_Days(@start,$i); printf("%4d/%02d/%02d\n", @date); } }

In reply to How to distribute time using Date::Calc module? by gube

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.