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!

Time modules

Status
Not open for further replies.

dwhalen

Programmer
Feb 22, 2002
105
CA
Hello,

I am performing some sql on a database and in the return array I get some interval datatypes and some date datatypes. I want to be able to summarize these return values but I don't know how to do this in Perl. Does Perl have some Time modules or some kinda date datatype that I can use to add up these values and divide them.

Thanks
 
Perl has all sorts of date processing abilities.

I think you might need to be a bit more specific in your request.

Also, look at:
localtime
time()
Time::* modules
 
What I need is some way of adding up the interval datatypes that postgres returns which come back with values like this: 4 days 03:04:42

How can I add these up and then divide by the total to get an average. I suppose I could use a reg exp. to filter out the values and add them up but I want a cleaner way. Also, where do I find information on the Time::* modules, I don't know where to look.

Thanks
 
I'm not entirely clear on what you're trying to accomplish... it sounds like you have a list of deltas (differences between two dates) and you're trying to find the average of those.

Take a look at the Date::Manip package on CPAN ( There are all kinds of date comparing routines available in this package.

is also a great source for documentation, modules, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top