This is explained in
perldoc Date::Calc
* "($Dd,$Dh,$Dm,$Ds) = Delta_DHMS($year1,$month1,$day1,
$hour1,$min1,$sec1, $year2,$month2,$day2, $hour2,$min2,$sec2);"
This function returns the difference in days, hours, minutes and
seconds between the two given dates with times.
All four return values will be positive if the two dates are in
chronological order, i.e., if date #1 comes chronologically BEFORE
date #2, and negative (in all four return values!) if the order of t
+he
two dates is reversed.
This is so that the two functions ""Delta_DHMS()"" and
""Add_Delta_DHMS()"" (description see further below) are
complementary, i.e., mutually inverse:
Add_Delta_DHMS(@date1,@time1, Delta_DHMS(@date1,@time1, @date2,@ti
+me2))
yields ""(@date2,@time2)"" again, whereas
Add_Delta_DHMS(@date2,@time2,
map(-$_, Delta_DHMS(@date1,@time1, @date2,@time2)))
yields ""(@date1,@time1)"", and
Delta_DHMS(@date1,@time1, Add_Delta_DHMS(@date1,@time1, @delta))
yields ""@delta"" again.
The result is zero (in all four return values) if the two dates and
times are identical.
--Jim
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.