Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Como obtener la fecha en JavaScript (https://www.clubdelphi.com/foros/showthread.php?t=80522)

dec 30-06-2006 00:31:35

Como obtener la fecha en JavaScript
 
Como obtener la fecha en JavaScript

Código:

  <SCRIPT LANGUAGE="JavaScript">

  dias = new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sábado")

  meses = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio",
                    "Agosto","Septiembre","Octubre","Noviembre","Diciembre")

  // No se entera el navegador que estamos en el 2000<br>
  function K(n){if ((n < 100)&&(n > 0)) return n+1900; else return n ;}

  hoy = new Date()

  var FechaALoFino = dias[hoy.getDay()] + ', ' + hoy.getDate() + ' ' +
                    meses[hoy.getMonth()] + ' de '+K(hoy.getYear())

  document.write('Fecha a lo burro: <B>' + hoy + '</B>')
  document.write('Fecha a lo fino: <B>' + FechaALoFino + '</B>');

  </SCRIPT>



La franja horaria es GMT +2. Ahora son las 11:16:26.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi