While I understand the whole "teach a man to fish" point of view, I can also say that saying "RTFM" is not an acceptable answer to any question.

I just wasted an hour reading Date::Manip docs to find how to use the module to find the difference in *days*, not in deltas as the documentation examples show.

If you think I've learned something now, or that I am now better off than just copying someone's pre-existing code - well, think again. In the hour I've lost, I could've been finished with my project already. I very rarely manipulate dates, so the little that I've learned about the module will be well forgotten by the time I'll need it again.

Anyway, this is the code I came up with (no idea how "efficient" it is):

perl -MDate::Manip -wle 'print Delta_Format(DateCalc("Sept 3, 2011", "Oct 5, 2011"), 2, "%dt")'

And if anyone cares to learn about the module, they can now go and read about those functions instead of couple score of pages about functions they'll never ever need to use!


In reply to Re: Date::Manip - date differences by Zoffix
in thread Date::Manip - date differences by rpike

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.