Just to clarify a couple of things; the contact can be 18 years or to age 40, whichever's longer.
Earliest you can leave is at the 4 week point & you can leave at any point up to week 26. For those Aircraft Handlers who don't opt out, they need to complete Initial Naval Training (2.5 months) + NA(AH) Training (6 months) + Return of Service (30 months) + Notice to Quit (12 months) = Minimum Service 50.5 Months or 4 years, 2 months & 2 weeks.
Must confess, I had the greatest of pleasures conducting a fire exercise (with smoke grenades) in the Air Treatment Unit that fed the Chockheads Messdeck in the daytime during their off-watch. This was following a particularly "busy" night of chain-gang activities in the hangar above my bunk.