It really depends on the season, some episodes were completed years before they air. Yeti Krabs was recorded in 2012, and it didn't air until 2015. Season 3 finished production in Winter 2002, but aired until October 2004. Goo Goo Gas was made in 2006, but it didn't air until the SpongeBob SpongeBash, in July 2009.I've heard that they're produced and ready to be broadcasted about a year in advance. Something about the copyright process or something of each episode and scheduling them afterwards. All we know is that it takes almost 1 year to produce it, just like @Yoh Manta said, so I would think an episode's beginning starts about 2 years before it premieres.