How many months does it take to travel to Mars?

Mars' trip usually takes about 300-400 Earth days but can be cut shorter if certain conditions were met. One condition is that when the spacecraft is launched during Mars' opposition. During a planetary opposition, Earth and another planet in the solar system are at the point where both planets are closest to each other. This is the time when the other planet is at the opposite side of the Earth as the Sun. NASA and other branches (JPL-Jet Propulsion Laboratory) knows about this and takes advantage of this event