Applies to : Date Object
The getUTDate method is use to get date in a Date object using Universal Coordinated Time (UTC).
Syntax
objDate.getUTCDate()
Return
Returns the date in a Date object using Universal Coordinated Time (UTC).
Example
To get the date using local time, use the getDate method.
The return value is an integer between 1 and 31 that represents the date value in the Date object.
The following example illustrates the use of the getUTCDate method:
function UTCDate()
{
var d, s = "Today's UTC date is: ";
d = new Date();
s += (d.getUTCMonth() + 1) + "/";
s += d.getUTCDate() + "/";
s += d.getUTCFullYear();
return(s);
}
document.write(UTCDate());
|
To run the code above, paste it into JavaScript Editor, and click the Execute button
See also: Date Object Methods, getDate Method, setDate Method, setUTCDate Method |