Languages
[Edit]
EN

JavaScript - English day names

10 points
Created by:
Anisha-Kidd
382

This article was created to speed up software developer programming by providing JavaScript arrays with day names.

Quick solution:

const DAY_FULL_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];

Note: days in the above are ordered according to Date class provided by JavaScript: Sunday first, Saturday last.

 

Abbreviations:

const DAY_SHORT_NAMES_1 = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
const DAY_SHORT_NAMES_2 = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];

 

Details

In this section, you can see other ways to name days of the week.

--------------------------------------------------------------------------------
|                                         |            [ day name ]            |
|-------------------------------------------------------------------------------
|                      |                  |  [ full name ]  [ abbreviations ]  |
|-------------------------------------------------------------------------------
|                      |                  |                                    |
|                      |                  |    Monday         Mon.   Mo.       |
|                      |   [ weekdays ]   |    Tuesday        Tue.   Tu.       |
|                      |                  |    Wednesday      Wed.   We.       |
|  [days of the week]  |    ( 5 days )    |    Thursday       Thu.   Th.       |
|                      |                  |    Friday         Fri.   Fr.       |
|                      |                  |                                    |
|       (7 days)       ---------------------------------------------------------
|                      |                  |                                    |
|                      |   [ weekend  ]   |    Saturday       Sat.   Sa.       |
|                      |    ( 2 days )    |    Sunday         Sun.   Su.       |
|                      |                  |                                    |
--------------------------------------------------------------------------------

Abbreviations (with dots):

const DAY_SHORT_NAMES_1 = ['Su.', 'Mo.', 'Tu.', 'We.', 'Th.', 'Fr.', 'Sa.'];
const DAY_SHORT_NAMES_2 = ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'];

Other:

const WEEKDAY_DAY_NAMES = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'];
const WEEKEND_DAY_NAMES = ['Saturday', 'Sunday'];

 

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join