Visit Mozilla.org

Referencia de JavaScript 1.5:Funciones globales:Date

De MDC


Tabla de contenidos

[editar] Summary

Core Function

Returns a string representation of the current date and time.

[editar] Syntax

Date()

[editar] Parameters

None.

[editar] Description

Date is a top-level function and is not associated with any object. It is also a constructor for Date objects.

The Date method returns a string representation of the current date and time. Its format is: Thu Aug 18 04:37:43 Pacific Daylight Time 1983.

The following are all equivalent:

Date()
(new Date()).toString()
String(new Date())

[editar] Examples

[editar] Example: Using Date

At the time of this writing, the following example displays a dialog box containing "Tue Sep 13 2005 15:36:21 GMT+0800":

alert(Date());

[editar] See also

Date