Date() (Function)

A function that returns the current date.

Availability:

ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Property/method value type:String primitive
JavaScript syntax:-Date()

This function returns a string primitive representing the current UTC time value.

When the Date() constructor is called as a function rather than in a new expression, it returns a string representing the current time (in UTC time). Note that when calling it as a function the arguments are all ignored and it is not equivalent to calling the Date() constructor in a new expression at all.

Effectively, the function call to a Date() constructor behaves as if you had coded this fragment of JavaScript in the script source text:

(new Date()).toString()

See also:Cast operator, Constructor function, constructor property, Date constant, Date() constructor, Implicit conversion

Cross-references:

ECMA 262 edition 2 - section - 15.1.3.7

ECMA 262 edition 2 - section - 15.9.2

ECMA 262 edition 3 - section - 15.9.2