JavaScript 1.3 Overview, Part I: UCT-Based Get Methods - Doc JavaScript
UCT-Based Get Methods
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:
Method | getUTCFullYear() |
Parameters | None |
Description | Returns the year of the specified date according to the Universal Coordinated Time. The return value is an absolute number, 1998 for example. |
Example | var myBirthYear; myBirthDate = new Date(); myBirthYear = myBirthDate.getUTCFullYear(); |
JavaScript 1.2 | getYear() |
|
Method | getUTCMonth() |
Parameters | None |
Description | Returns the month of the specified date according to the Universal Coordinated Time. The return value is an integer between 0 (January) and 11 (December). |
Example | var myBirthMonth; myBirthDate = new Date(); myBirthMonth = myBirthDate.getUTCMonth(); |
JavaScript 1.2 | getMonth() |
|
Method | getUTCDate() |
Parameters | None |
Description | Returns 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 . |
Example | var myBirthDayM; myBirthDate = new Date(); myBirthDayM = myBirthDate.getUTCDate(); |
JavaScript 1.2 | getDate() |
|
Method | getUTCDay() |
Parameters | None |
Description | Returns 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). |
Example | var myBirthDayW; myBirthDate = new Date(); myBirthDayW = myBirthDate.getUTCDay(); |
JavaScript 1.2 | getDay() |
|
Method | getUTCHours() |
Parameters | None |
Description | Returns 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 . |
Example | var myBirthHour; myBirthDate = new Date(); myBirthHour = myBirthDate.getUTCHours(); |
JavaScript 1.2 | getHours() |
|
Method | getUTCMinutes() |
Parameters | None |
Description | Returns 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 . |
Example | var myBirthMinute; myBirthDate = new Date(); myBirthMinute = myBirthDate.getUTCMinutes(); |
JavaScript 1.2 | getMinutes() |
|
Method | getUTCSeconds() |
Parameters | None |
Description | Returns 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 . |
Example | var myBirthSecond; myBirthDate = new Date(); myBirthSecond = myBirthDate.getUTCSeconds(); |
JavaScript 1.2 | getSeconds()
|
|
Method | getUTCMilliseconds() |
Parameters | None |
Description | Returns 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 . |
Example | var myBirthMS; myBirthDate = new Date(); myBirthMS = myBirthDate.getUTCMilliseconds(); |
JavaScript 1.2 | None |
|
Created: September 11, 1998
Revised: September 11, 1998
URL: https://www.webreference.com/js/column25/dateget.html