Manager: We (meaning you) need to do task A. How long will it take?
Me: Task A will take X days to do.
Manager: That seems awful long.
Me: How long do you think it should take?
Manager: It surely could not take any longer than Y days.
Me: Ok, it seems you have an answer to your question then.
Later:
Manager: It’s been Y days, why isn’t task A done yet?


Read Software Estimation by Steve McConnell and recommend it to your manager:
The person doing the work the one best suited to estimate it.
Also, start tracking estimated vs budgeted time in some searchable system.
Next time this comes up, look up how long it actually took to complete a similar task instead of thoughts and prayers.
If boss won’t track historical budget vs actual, track it yourself.
The way we estimate on my team is to break tasks down into related subtasks that will take one day or less, then add up all the subtasks. It’s worked pretty well.
That pattern is also recommended in the book. Break down estimates into chunks of 5 hours or less.
With lots of smaller tasks, estimates tend to both be more accurate due to smaller scope, and some of the over/under inaccuracies will cancel out.
As a manager in found this to be partially false.
Most persons doing the work quote forget that shit happens. Except for the few reliable persons I supervised, I usually always asked the follow-up question: what “unforeseen crap” time did you include, and made sure to leave with 3 values: all goes well (which I kept to myself), usual estimate, what if bad shit happens. Then I’d just use the standard pert guesstimate for my official schedules, making sure to include normal dead time which employees often forget (e.g. 8 days work is really 2 full weeks when accounting for meetings).
Oh yeah. It takes experience and clear head to remember to account for all the inevitables that are going to happen besides actual dev-hours-to-create-this. A hard lesson I am still learning