As the Vietnam experience demonstrated all too clearly, once you set a timetable for withdrawal, you have doomed yourself to defeat. The enemy knows that he must merely wait you out - and, perhaps, bring forward your timetable by escalating his efforts. Of course, you also entirely demoralise your troops, who wonder why on earth they're giving their all to an apparently important campaign that's about to cease at some arbitrary near-future date.
Which is why it's dumb when politicians suggest that a conflict should be time-limited.