The Time::localtime and Time::gmtime modules give you direct access by name to the time components. I can't test right now if they work in your context, but I think they should, since they appear to return a hash or probably rather a blessed reference to a hash.