Skip to content
Cover image for Body BackgroundColor change with Date object

Body BackgroundColor change with Date object

yashwanthambati profile image Yashwanth twitter logo github logo ・1 min read  

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

twitter logo DISCUSS
markdown guide
Classic DEV Post from Jul 30 '19

PublishTo.Dev: Scheduling article publishing on

Yashwanth profile image
Js developer , full stack