On Tue, 28 Feb 2006, Praveen Ray wrote:

Is there a way to get the difference in days , between two dates?

$dur  = $dt1 - $dt2;

print $dur->days,"\n"

prints days between two dates after factoring out higher units (as the documentation says).
How do I get the difference in 'days' ?

There's a couple things you can do:

First, do this:

 $dur = $dt1->delta_days($dt2);

 print $dur->days;

Alternately, you use DateTime::Format::Duration to take an existing duration object and get various values out of it.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

Reply via email to