| Availability: |
| ||||||||
| Property/method value type: | UTC time in milliseconds | ||||||||
| JavaScript syntax: | |||||||||
| - | Date.UTC(aYear, aMonth) | ||||||||
| - | Date.UTC(aYear, aMonth, aDate) | ||||||||
| - | Date.UTC(aYear, aMonth, aDate, anHour) | ||||||||
| - | Date.UTC(aYear, aMonth, aDate, anHour, aMinute) | ||||||||
| - | Date.UTC(aYear, aMonth, aDate, anHour, aMinute, aSecond) | ||||||||
| - (JavaScript 1.3 +) | Date.UTC(aYear, aMonth, aDate, anHour, aMinute, aSecond, aMillisecond) | ||||||||
| Argument list: | aDate | An optional date within the month value | |||||||
| aMillisecond | An optional value between 0 and 999 milliseconds | ||||||||
| aMinute | An optional value between 0 and 59 minutes | ||||||||
| aMonth | An optional 0 to 11 month value | ||||||||
| anHour | A value between 0 and 23 hours | ||||||||
| aSecond | An optional value between 0 and 59 seconds | ||||||||
| aYear | A full year value | ||||||||
| aValue | A time in UTC milliseconds | ||||||||
This method returns a date value with the indicated date and time value.
When the Date.UTC() method is called, it interprets the arguments as UTC time values and returns a number representing the UTC time in milliseconds.
The value stored in the new date object depends on the argument values that are supplied. The arguments are all optional but are positional so, if an argument is missing, it is assumed to be the last argument and so on.
Functionally, the algorithm that manufactures a new date value uses the internal MakeDay(), MakeTime() and MakeDate() methods that we describe elsewhere.
If the year value is less than 99, then the date creation adds 1900 to it and assumes the date is in the 20th century. To avoid millennium problems, always specify a full year number.
Where arguments are omitted, zero values are assumed for hours, minutes and seconds. When all three are missing, the time is assumed to be midnight.
An incomplete date with zero, one or two arguments will behave in an implementation dependent way and might yield a different result depending on the platform supporting the script interpreter.
| See also: | Date(), Date.constructor, MakeDate(), MakeDay(), MakeTime(), TimeClip() |
ECMA 262 edition 2 - section - 15.9.4.3
ECMA 262 edition 2 - section - 15.9.4.4
ECMA 262 edition 2 - section - 15.9.4.5
ECMA 262 edition 2 - section - 15.9.4.6
ECMA 262 edition 2 - section - 15.9.4.7
ECMA 262 edition 2 - section - 15.9.4.8
ECMA 262 edition 2 - section - 15.9.4.9
ECMA 262 edition 2 - section - 15.9.4.10
ECMA 262 edition 3 - section - 15.9.4.3
| Prev | Home | Next |
| Date.toUTCString() | Up | Date.valueOf() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||