Availability
JavaScript 1.0; JScript 1.0; ECMAScript v1
Synopsis
Date.UTC(year, month, day, hours, minutes, seconds, ms)Arguments
year
The year in four-digit format. If this argument is between 0 and 99,
inclusive, 1900 will be added to it and it will be treated as a year
between 1900 and 1999.
month
The month, specified as an integer from 0 ( January) to 11 (December).day
The day of the month, specified as an integer from 1 to 31. Note that
this argument uses 1 as its lowest value, while other arguments use 0
as their lowest value. This argument is optional.
hours
The hour, specified as an integer from 0 (midnight) to 23 (11 p.m.).
This argument is optional.
minutes
The minutes in the hour, specified as an integer from 0 to 59. This
argument is optional.
seconds
The seconds in the minute, specified as an integer from 0 to 59. This
argument is optional.
ms
The number of milliseconds. This argument is optional and is ignored
prior to ECMAScript standardization.
Returns
The millisecond representation of the specified universal time. That
is, this method returns the number of milliseconds between midnight
GMT on January 1, 1970 and the specified time.
Description
Date.UTC( ) is a static method; it is invoked
through the Date( ) constructor, not through an
individual Date object.
The arguments to Date.UTC( ) specify a date and
time and are understood to be in UTC (Universal Coordinated
Time) -- they are in the GMT time zone. The specified UTC time is
converted to the millisecond format, which can be used by the
Date( ) constructor method and by the
Date.setTime( ) method.
The Date( ) constructor method can accept date and
time arguments identical to those that Date.UTC( )
accepts. The difference is that the Date( )
constructor assumes local time, while Date.UTC( )
assumes universal time (GMT). To create a Date object using a UTC
time specification, you can use code like this:
d = new Date(Date.UTC(1996, 4, 8, 16, 30));
See Also
Date, Date.parse( ), Date.setTime( )
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.