Judge Daniel Nishigaya of Santa Clara County Superior Court ruled that Smith could serve his time, reduced to 11 days after receiving credit for one day served, on a work crew on consecutive Mondays beginning July 28. Smith also was placed on three years' court probation.
Nishigaya reduced weapons charges against Smith from felonies to misdemeanors because of the player's background, character and future prospects.
Earlier this month, the Los Angeles City Attorney's office, following a lengthy review, announced that Smith would not face misdemeanor charges stemming from an arrest for allegedly making a fake bomb threat at Los Angeles International Airport in April.
The 49ers open camp Wednesday, and they have their first practice Thursday. Smith's original hearing was scheduled for next Friday but was moved up at the request of the prosecutor, who had a family emergency.
Smith, 24, has 42 sacks in 43 regular-season games with San Francisco.