How to use getUTCDate in JavaScript
In this article, I will explain use of getUTCDate() method in JavaScript date object.
JavaScript getUTCDate() method
-
getUTCDate() of date object method returns the date of the month of the date object, according to Coordinated universal time.
-
In getUTCDate() method, the retune value is integer value between 1 to 31.
-
UTC is The Universal Coordinated Time. it is the set by the World Time Standard.
-
UTC time is the same as GMT time.
Syntax
Example
In the following example show to getUTCDate() method returns the day of a specified date and current date according to universal time.
<!DOCTYPE html>
<html>
<body>
<h3 style="color:Blue">JavaScript getUTCDate() Method Example</h3>
<p id="demo">Click for display the UTC day of the month for the given local date-time.</p>
<button onclick="myFunction()">Click On</button>
<script type="text/javascript">
function myFunction() {
var d = new Date("July 12, 1989 03:15:00");
var x = document.getElementById("demo");
x.innerHTML = d.getUTCDate();
document.write("UTC day of the Month: " + d.getUTCDate());
}
</script>
</body>
</html>
|
Output1
Output2
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here