Your question isn't terribly clear, however... dates are always tricky creatures, and I'd advocate a look at
Date::Manip or
Date::Calc (which is faster, but C based) which will do what I think you want to do, along with almost any other date manipulation you need.