in reply to Compare Date and Time

This kind of question get asked so often... and the general answer is to use a suitable date/time managing module. Two such modules (that I have tried) are DateTime and Date::Calc. Try reading their respective documentations to see if they suit your needs.