Development| HTML| JavaScript| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JavaScript getUTCDay() method 
 

In JavaScript the method getUTCDay() returns a number between 0-6 inclusive and these numbers represent the day of the week according to the Universal Coordinated Time (UTC).

 

JavaScript getUTCDay() method

                         

In JavaScript the method getUTCDay() returns a number between 0-6 inclusive and these numbers represent the day of the week according to the Universal Coordinated Time (UTC). In the following list we have provided you the week day according to the numbers as follows:

Number  Day
0 Sunday
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday

Syntax:

 Date_object.getUTCDay();

Where Date_object is the Date object that we required to call the getUTCDay() method. In the following example we will describe you how to use getUTCDay() method.

Description of code:

To illustrate the use of getUTCDay() method we have created a simple button into a HTML page and this button when clicked calls the user defined function getUTCDayFunc() which is defined in the JavaScript ( in <script> tags).

 
 function getUTCDayFunc(){
		  var myDate = new Date(); 
	    	  alert(myDate.getUTCDay());
	    }

In the above lines of code we have taken the date object into variable myDate and now further we will use this date object for finding the UTC day of the week on the particular date.

Here is the full HTML code, which illustrates the use of getUTCDay() method :

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

Output :

When user clicks on the button "Show UTC day" it returns a number between 0-6. For example in our case it returned 3 which represents "wednesday".

You can also download the full code from the following link.

Download Source Code

                         

» View all related tutorials
Related Tags: java javascript html c table script delete object header method ip page oo create tab footer with e il it

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.