YouTip LogoYouTip

Jsref Getutcday

(function () { if (window.location.protocol !== 'https:') { window.location.href = 'https:' + window.location.href.substring(window.location.protocol.length); } })();

JavaScript getUTCDay() Method |

Definition and Usage

The getUTCDay() method returns the day of the week for a given date, according to universal time. The returned value is an integer between 0 and 6, where 0 represents Sunday, 1 represents Monday, and so on.

Syntax

dateObject.getUTCDay()

Return Value

An integer from 0 to 6, representing the day of the week in UTC time.

Example

This example demonstrates how to use the getUTCDay() method to get the day of the week for the current date in UTC:

<html>
<body>

<script>
var d = new Date();
document.write("UTC Day: " + d.getUTCDay());
</script>

</body>
</html>

Output

UTC Day: 4

Browser Support

All major browsers support this method.

More Examples

Display the day of the week in words using the getUTCDay() method:

<html>
<body>

<script>
var d = new Date();
var weekday = new Array(7);
weekday = "Sunday";
weekday = "Monday";
weekday = "Tuesday";
weekday = "Wednesday";
weekday = "Thursday";
weekday = "Friday";
weekday = "Saturday";

document.write("UTC Day: " + weekday[d.getUTCDay()]);
</script>

</body>
</html>

Output

UTC Day: Thursday

← Jsref GetutcfullyearJsref Getutcdate β†’