Ghizzetti's theorem for piecewise continuous solutions