The getUTCDate
function in JavaSript is a method of the Date class
. The function returns the day of the month in accordance with Universal Time Coordinated (UTC).
Date.getUTCDate()
The getUTCDate
function does not take any parameters and returns the current day as an integer.
// an object of Date type is createdvar obj = new Date('November 4, 2001 09:24:21');console.log("DAY: " + obj.getUTCDate());
The function returns the current date as an integer in the above snippet of code, and it is printed on the console.
// an object of Date type is createdvar obj = new Date();console.log("CURRENT DAY: " + obj.getUTCDate());
In the above example, an object of Date is created using the default constructor. This will set the value of obj
to the current date. Then, the getUTCDate
function is called to get the current day as an integer.
Free Resources