Date.getUTCDay()

JavaScript 1.2+, ECMAScript 1.0+, JScript 3.0+ Nav4+, IE 4+, Opera3+ Syntax

							date.getUTCDay()

Description

The getUTCDay() method returns the day of the week converted to universal time and expressed as an integer from 0 (Sunday) to 6 (Saturday).

Example

The code in Listing 6.82 uses the getUTCDay() method to return the day of the week expressed as an integer in universal time. The number is then converted to a string equivalent to the day of the week.

Listing 6.82 Using the getUTCDay() Method to Return the Day of the Week
<html>

<script language="JavaScript">
<!-- Hide
							
							 //This function converts the day from a number to //a string and returns the string. function getDayString(num) { var day; //Create a local variable ...

Get Pure JavaScript 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.