While I don't think there's a built-in function for what you're looking for, the module
Date::Calc provides a whole range of functions for dealing with dates and times. I'm sure there are things in there that would be useful.
Rich36
There's more than one way to screw it up...