spacer

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

home / experts / javascript / column25


UCT-Based Get Methods

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

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


The Network for Technology Professionals

Search:

About Internet.com

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

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


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

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