Hello Monks!
Please help me to add knowledge to my brain.
Given following snippet:
use Time::Local;
$from_year = $from_year - 1900;
$from_month = $from_month - 1;
$from = timelocal(0,0,0,$from_day,$from_month,$from_year);
$to_year = $to_year - 1900;
$to_month = $to_month - 1;
$to = timelocal(0,0,0,$to_day,$to_month,$to_year);
$days_between = ( ($to - $from) / (60 * 60 * 24) );
Now I use this values for input....
$from_day = 2;
$from_month = 2;
$from_year = 2002;
$to_day = 5;
$to_month = 2;
$to_year = 2002;
.....and get the right result: $days_between = 3
But now to my confusion: I use this values......
$from_day = 2;
$from_month = 2;
$from_year = 2002;
$to_day = 2;
$to_month = 5;
$to_year = 2002;
....the result ist not even: $days_between = 88.95...
Who can enlighten me?
Thanks for your experience-sharing!
Georg
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.