Home Javascript JavaScript getUTCDate method
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

JavaScript getUTCDate method

Advertisement
getUTCDate() method of JavaScript when applied to a date object returns an integer value between 1 and 31 that represents day from the date object's month.

JavaScript getUTCDate method

     

getUTCDate() method of JavaScript when applied to a date object returns an integer value between 1 and 31 that represents day from the date object's month. In this part of JavaScript method tutorial we will describe you getUTCDate() method with a simple example.

Syntax :

 object_date.getUTCDate();

Where object_date is the date object from which getUTCDate() method will return the date of month.

In this example, we have created a button "Show UTC date". This button when clicked calls the method getUTCDateFunc(). Here we have taken the current date value into the variable named "myDate". Now we can call the method getUTCDate() by using date object.

 function getUTCDateFunc(){
	var myDate = new Date(); 
	alert(myDate.getUTCDate());
	};

Above lines of code is the function that we have defined in our JavaScript's <script></script> tag. Here is the full example code for getUTCDateExample.html as follows :

<html>
<head>
	<title>Get UTC date example</title>
	<script>
	function getUTCDateFunc(){
			var myDate = new Date(); 
	    	alert(myDate.getUTCDate());
	    	}
	</script>	
</head>
<body>
<div style="background: #ffdddd; width:'100%';" 
         align="center">
  <font color="#000012" size="12pt">
	<b>Get UTC date example</b>
  </font>
 </div>
  <center>
  <p>&nbsp;</p>
  <input type="button" onclick="getUTCDateFunc();" 
        value="Show UTC date">
</center>
</body>
</html>

Output of example :

Click on the button "Show UTC date", it will display UTC date value into the alert message.

You can also download the full source code from the following link :

Download Source Code

     

Advertisement

Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 7, 2009

Ask Questions?    Discuss: JavaScript getUTCDate method  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com