When is the best time to get a flu shot for maximum effectiveness?

When is the best time to get a flu shot for maximum effectiveness?