Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date manipulation

Status
Not open for further replies.

jkalos

IS-IT--Management
Oct 24, 2000
6
US
is there a Perl date object or function that i can use that will allow me to add days to a given date

thanks
 
Hello jkalos,
I have not had occassion to play with them, but, there are quite a few available from cpan at
Alternatively, I have manipulated dates via the 'time' and 'localtime' functions. Since the 'time' function deals in seconds since 1.1.1970, you can do all you manipulations in seconds ( not really that big-a-deal) and use 'localtime' to convert it for output. This is very straightforward and flexible.

'hope this helps....





keep the rudder amid ship and beware the odd typo
 
I've also used Date::Manip in the past - very nice package that does almost any date math you can think of, but even the documentation says that it is NOT fast. If you are batch processing many many records, and you need to do date math on each one, and time is critical, then Date::Manip is probably not what you want to use. If all you need to do is add or subtract days to/from a given date, then you might be better off writing your own(assuming you can get both dates in the form "seconds since the Epoch" as "goBoating" suggested), or another CPAN alternative is Date::Calc, but I have no experience with that one.
Hardy Merrill
Mission Critical Linux, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top