in reply to gmtime

While this module can introduce a lot of unnecessary overhead, you might want to look at Date::Manip. It can do just about anything you would want with regard to date comparison, manipulation, conversion, etc. Consider it an all-in-one suite of about a dozen other date modules. It's very easy to use, but like I said, high overhead. Specifically, look at the UnixDate() function in this module. Hope this helps.