spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column25


UCT-Based Get Methods

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

JavaScript 1.3 supports Universal Coordinate Time. There are two groups of the Date object's methods. The first ones include methods to get UCT's components of time (year, month, date, day, hour, minute, second, millisecond) from a given Date object. The other group includes methods to set these components in a given Date object. The following table summarizes the Get Methods:

MethodgetUTCFullYear()
ParametersNone
DescriptionReturns the year of the specified date according to the Universal Coordinated Time. The return value is an absolute number, 1998 for example.
Examplevar myBirthYear;
myBirthDate = new Date();
myBirthYear = myBirthDate.getUTCFullYear();
JavaScript 1.2getYear()

MethodgetUTCMonth()
ParametersNone
DescriptionReturns the month of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 (January) and 11 (December).
Examplevar myBirthMonth;
myBirthDate = new Date();
myBirthMonth = myBirthDate.getUTCMonth();
JavaScript 1.2getMonth()

MethodgetUTCDate()
ParametersNone
DescriptionReturns the day of the month of the specified date according to the Universal Coordinated Time. The return value is an integer between 1 and 31.
Examplevar myBirthDayM;
myBirthDate = new Date();
myBirthDayM = myBirthDate.getUTCDate();
JavaScript 1.2getDate()

MethodgetUTCDay()
ParametersNone
DescriptionReturns the day of the week of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 (Sunday) and 6 (Saturday).
Examplevar myBirthDayW;
myBirthDate = new Date();
myBirthDayW = myBirthDate.getUTCDay();
JavaScript 1.2getDay()

MethodgetUTCHours()
ParametersNone
DescriptionReturns the hour of the day of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 and 23.
Examplevar myBirthHour;
myBirthDate = new Date();
myBirthHour = myBirthDate.getUTCHours();
JavaScript 1.2getHours()

MethodgetUTCMinutes()
ParametersNone
DescriptionReturns the minutes of the hour of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 and 59.
Examplevar myBirthMinute;
myBirthDate = new Date();
myBirthMinute = myBirthDate.getUTCMinutes();
JavaScript 1.2getMinutes()

MethodgetUTCSeconds()
ParametersNone
DescriptionReturns the seconds of the minute of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 and 59.
Examplevar myBirthSecond;
myBirthDate = new Date();
myBirthSecond = myBirthDate.getUTCSeconds();
JavaScript 1.2getSeconds()

MethodgetUTCMilliseconds()
ParametersNone
DescriptionReturns the milliseconds of the second of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 and 999.
Examplevar myBirthMS;
myBirthDate = new Date();
myBirthMS = myBirthDate.getUTCMilliseconds();
JavaScript 1.2None

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: September 11, 1998
Revised: September 11, 1998

URL: http://www.webreference.com/js/column25/dateget.html