Working with Days
You might want to display a different message to your users if it’s a weekend. Script 12.2 tells you how to do it.
Figure 12.2. The happy news gets written to the window.
To figure out if it is a weekend:
1. | var now = new Date(); |
2. | if (now.getDay() > 0 && now.getDay() < 6) { |
3. | dtString = "Sorry, ... |
Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.