The meaning of this idiom is that you should never feel hopeless when times get hard or difficult because difficult times always lead to better days. The difficult times are like dark clouds that blocks the sun. When we look at the edges of the cloud more closely, we can see the sun shining there like a silver lining.