We know this because in Act 1 Scene 2, Hamlet says “Heaven and earth!
Hamlet: Soliloquy Act 1 Scene 2 ..
Let her not walk i’ the sun: conception is a blessing; but as your daughter may conceive, friend, look to ‘t.”- Hamlet (Act 2, Scene 2, lines 181-185)
Hamlet’s use of the imagery of a decomposing dead dog is a metaphor to the rotting state of Denmark and the corrupt goings-on.
Shakespeare tries to show that the sun, just like King Claudius, can spread corruption.
Act 1, Scene 1 | Hamlet | William Shakespeare | Lit2Go ETC
The importance of the sun can be seen when Claudius asks, “How is it that the clouds still hang on you?” Hamlet replies, “Not so, my lord; I am too much in the sun” (Act 1, Scene 2, Line 67).