I love deadlines; I especially like the SWOOSHING sound they make as they fly past
— Douglas Adams
Deadlines are made after the work needed to meet the deadline is defined and the appropriate schedule, cost, and resource utilization margins have been discovered. These values must be worked from right to left if the deadline has already been fixed.
This will tell you when you should have started the project. The process of defining he needed schedule margin is provided by a Monte Carlo Simulator tool. My favorite is Risk+. This tool prouces confidence levels for completing "on or before" a specified date. With a "zero slack" schedule, Risk+ can tell the probabilistic completion date to a level of confidence. 80% confidence of completing "on or before" is a good number. The gap between your "zero slack" date and the 80% is the needed margin for the "zero slack" schedule.
The next issue is where to put that schedule margin. That's another topic.