please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Date.UTC() Function

Name

Date.UTC() Function---convert a date specification to milliseconds

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

Date.UTC(year, month, day [, hours [, minutes [, seconds]]]);

Arguments

year

The year minus 1900. For example, specify 96 for the year 1996.

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.

hours

The hour, specified as an integer from 0 (midnight) to 23 (11 p.m.). This argument may be omitted if minutes and seconds are also omitted.

minutes

The minutes in the hour, specified as an integer from 0 to 59. This argument may be omitted if seconds is also omitted.

seconds

The seconds in the minute, specified as an integer from 0 to 59. This argument may be omitted.

Returns

The number of milliseconds between midnight on January 1st, 1970, UTC and the time specified (also in UTC) by the arguments.

Description

Date.UTC() is a function with a name that begins with "Date". It is related to the Date object, but it is not a method of the Date object, and is not invoked on a Date object. It is always invoked as Date.UTC(), not as date.UTC() on some Date object date.

The arguments to Date.UTC() specify a date and time, and are understood to be in UTC (Universal Coordinated Time)--i.e., 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.

Usage

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 UTC. To create a Date object using a UTC time specification, you can use code like this:

d =index.html new Date(Date.UTC(96, 4, 8, 16, 30));

Bugs

In Navigator 2.0, Date.UTC() does not compute the correct number of milliseconds.

See Also

"Date", "Date.parse()", "Date.setTime()"


Previous Home Next
Date.toLocaleString() Book Index defaultStatus

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/refp_69.htm, 7KB, , updated: 2019/10/14 15:00, local time: 2024/11/20 04:27,
TOP NEW HELP FIND: 
18.119.162.74:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/java/script/definitive/refp_69.htm"> [Chapter 21] Reference: Date.UTC()</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .