Date

  • Enlace amigable (slug) de la revisión: Referencia_de_JavaScript_1.5/Funciones_globales/Date
  • Título de la revisión: Date
  • Id de la revisión: 142043
  • Creada:
  • Creador: Sheppy
  • ¿Es la revisión actual? No
  • Comentario New page: <breadcrumbs></breadcrumbs> == Summary == '''Core Function''' Returns a string representation of the current date and time. == Syntax == <code> Date() </code> == Parameters == None. ...

Contenido de la revisión

Summary

Core Function

Returns a string representation of the current date and time.

Syntax

Date()

Parameters

None.

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())

Examples

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());

See also

Date

{{ wiki.languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Fonctions_globales/Date", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Funkcje/Date" } ) }}

Fuente de la revisión

<p>
</p>
<h3 name="Summary"> Summary </h3>
<p><b>Core Function</b>
</p><p>Returns a string representation of the current date and time.
</p>
<h3 name="Syntax"> Syntax </h3>
<p><code>
Date()
</code>
</p>
<h3 name="Parameters"> Parameters </h3>
<p>None.
</p>
<h3 name="Description"> Description </h3>
<p><code>Date</code> is a top-level function and is not associated with any object. It is also a constructor for <a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Date"><code>Date</code></a> objects.
</p><p>The <code>Date</code> method returns a string representation of the current date and time. Its format is: Thu Aug 18 04:37:43 Pacific Daylight Time 1983.
</p><p>The following are all equivalent:
</p>
<pre class="eval">Date()
(new Date()).toString()
String(new Date())
</pre>
<h3 name="Examples"> Examples </h3>
<h4 name="Example:_Using_Date"> Example: Using <code>Date</code> </h4>
<p>At the time of this writing, the following example displays a dialog box containing "Tue Sep 13 2005 15:36:21 GMT+0800":
</p>
<pre class="eval">alert(Date());
</pre>
<h3 name="See_also"> See also </h3>
<p><a href="es/Core_JavaScript_1.5_Reference/Global_Objects/Date"><code>Date</code></a>
</p>
<div class="noinclude">
</div>
{{ wiki.languages( { "fr": "fr/R\u00e9f\u00e9rence_de_JavaScript_1.5_Core/Fonctions_globales/Date", "pl": "pl/Dokumentacja_j\u0119zyka_JavaScript_1.5/Funkcje/Date" } ) }}
Revertir a esta revisión