Code Comments
Programming Forum and web based access to our favorite programming groups.I have the current releace of ActiveState for Win32. I'mby the shear number of time and date modules and exactly what they are capable of doing. I need help calculating the number of days (including w
ends) between two dates. All dates are in the format of mm/dd/yyyy. This format can be changed if needed. What module is best to use and what is the format of the function. Thanks. Fred
Post Follow-up to this messageFred Goldberg wrote: > I have the current releace of ActiveState for Win32. > > I'mby the shear number of time and date modules and exactly what > they are capable of doing. I need help calculating the number of days > (including w
ends) between two dates. All dates are in the format of > mm/dd/yyyy. This format can be changed if needed. > > What module is best to use and what is the format of the function. Thanks. Time::Local should do the trick The docs are pretty straight forward. timelocal is most likely the function you're after. B.
Post Follow-up to this messageFred Goldberg wrote: > I'mby the shear number of time and date modules and > exactly what they are capable of doing. I need help calculating the > number of days (including w
ends) between two dates. All dates > are in the format of mm/dd/yyyy. This format can be changed if > needed. > > What module is best to use Probably Date::Calc. > and what is the format of the function. See the docs for the module. Reading the docs doesn't confuse you, does it? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
Post Follow-up to this messageBrendon Caligari wrote: > Fred Goldberg wrote: > > Time::Local should do the trick Well, I agree, even if I suggested Date::Calc in another message. Reminds me of another thread in this group: http://groups.google.com/groups?sel...40uni-berlin.de -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
Post Follow-up to this messageBrendon Caligari (bcaligari@nospam.fireforged.com) wrote on MMMMXLVI September MCMXCIII in <URL:news:4159d38b$0$94918$bed64819@news.gradwell.net> : __ Fred Goldberg wrote: __ __ > I have the current releace of ActiveState for Win32. __ > __ > I'mby the shear number of time and date modules and exactly w hat __ > they are capable of doing. I need help calculating the number of days __ > (including w
ends) between two dates. All dates are in the format of __ > mm/dd/yyyy. This format can be changed if needed. __ > __ > What module is best to use and what is the format of the function. Than ks. __ __ Time::Local should do the trick Well, it can do the trick, and so can Math::BigInt. __ The docs are pretty straight forward. timelocal is most likely the __ function you're after. Really? If I look at the pretty straight forward docs, the docs tell me that timelocal takes a date/time value which is broken down in seconds, minutes, hours, day of month, month and year (with the month counted as January 0, February 1, etc, and some complicated rules on what the year should be), and returns an integer giving us seconds since January 1, 1970 GMT. (It falsely says midnight, but it's actually about half a minute past midnight, due to leap seconds). It takes some extra work to use this to calculate the difference between two dates correctly. The docs also say it may not work for dates before Jan 1, 1970. Nor will it, according to the docs, work on most systems for dates before Dec 1901, or after Jan 2038. I'd say that while it's not impossible to use Time::Local, it's awkward, and will only work for a limited set of dates. Date::Calc on the other hand has a function, Delta_Days() that does exactly what the OP wants. Abigail -- $_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop} ; $chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ( ) -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ( )
Post Follow-up to this messageFred Goldberg wrote: > I have the current releace of ActiveState for Win32. > > I'mby the shear number of time and date modules and exactly what > they are capable of doing. I need help calculating the number of days > (including w
ends) between two dates. All dates are in the format of > mm/dd/yyyy. This format can be changed if needed. > > What module is best to use and what is the format of the function. Thanks. > > Fred > As other posters have stated, try Date::Calc. I use it in production code at work. IIRC, ActiveState has a ppm for Date::Calc which means that you don't need to have an installed C-compiler to install it. And DeltaDays is indeed the function you want to use. jimk
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.