How can I change an image depending on the time of day?

A useful effect can be to change CSS elements depending on the time of day. The following example changes a background image.

var d = new Date();
var n = d.getHours();
if (n > 19 || n < 6)
   $("#header").css("background", "url('nacht.jpg')");
else
   $("#header").css("background", "url('tag.jpg')");
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.