Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

date manipulation

date manipulation

date manipulation

is there a Perl date object or function that i can use that will allow me to add days to a given date


RE: date manipulation

Hello jkalos,
I have not had occassion to play with them, but, there are quite a few available from cpan at http://www.cpan.org/modules/by-module/Date/.

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

RE: date manipulation

I've had some luck with Date::Manip, try that one.

Tom Anderson
CEO, Order amid Chaos, Inc.

RE: date manipulation

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close