This is a tricky question, because it depends on why you want to prune the tree! Most trees can be pruned at any time of the year, especially if the goal is to remove the dead, dying, and diseased branches; thin and shape the tree; or trim the tree away from a building or electric wires. Personally, I like ornamental pruning in the dormant season (winter), because the branching structure is more easily visible since the leaves are gone. I can still tell which branches are alive by the presence of buds.
Fruit trees, when used for agriculture, are best when pruned just after fruit drop. This gives the tree more time to grow after pruning, and just before going dormant, the tree will make the flower buds for the next year. If you prune after the tree is dormant, you will cut off many flower buds that the tree has already created. If you remove all the flower buds, it follows that you will have no fruit the next year, although the tree is likely to live. If you remove some of the flower buds, anytime before fruiting, you will get larger fruit. More flowers is to plentiful small fruit, as less flowers is to less plentiful larger fruit. Knowing this, if the tree’s purpose is not the fruit, but rather the flowers, then we want to prune just after flowering.
Be careful not to prune too heavily before the hottest part of the year, as stress and sun tend not to mix well.