Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Do you know where your variables are?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

The CPAN library, at http://search.cpan.org, contains thousands of packages which deals with dates, such as Date::Calc, Date::Manip, or Date::Simple.

For example, click on the Date::Simple link and look at the EXAMPLES section:

use Date::Simple (); my $date = Date::Simple->new('1972-01-17'); ...

An opaque object as provided by this particular (pre-built, pre-tested) CPAN package, has among other things the ability to parse a date-string such as the one that you have, and to “do things with” the resulting date-value.   You do not have to be concerned with exactly how the magic works, because the logic has been rigorously tested (even as part of the process of installing the package on your system).   To you, that object “is a” date, and a very smart one at that.

Although this particular package deals only with dates, not hours ... have a peek now at, say, Date::Calc::Object or Date::Calc.   :-)   Truly, there is nothing having to do with dates ... no, not even in the Mayan calendar (DateTime::Calendar::Mayan), if you are so inclined, whereby you must “roll your own.”


In reply to Re: get remaining hours by sundialsvc4
in thread get remaining hours by doubledecker

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (7)
    As of 2014-04-18 03:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (461 votes), past polls