.getDay()

Called from an instance of the Date class, will return the day of the week.

Syntax

Loading...

The return value of getDay() will only be an integer number between 0 and 6:

  • 0 meaning Sunday
  • 1 meaning Monday
  • 2 meaning Tueseday
  • 3 meaning Wednesday
  • 4 meaning Thursday
  • 5 meaning Friday
  • 6 meaning Saturday

Example

To determine if it is Friday or not:

Loading...
Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn JavaScript on Codecademy