DEV Community

Cover image for Body BackgroundColor change with Date object
Yashwanth
Yashwanth

Posted on

Body BackgroundColor change with Date object

If you want to try out Date object in javascript ,this is a perfect example.

There are differnt methods in date object. I used getHours() method to change the color according to time.
Here is the html code

Here is the code for javascript code

  • Here is the codepen link if you want play/implement.
  • If you want to get deeper into Date methods, then have a look at MDN docs.
  • Post your best use of Date in comments and love to see yours.Hope you like this example.

Good Stuff

Top comments (0)