Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/05/2002, 02:13
Avatar de Mickel
Mickel
 
Fecha de Ingreso: mayo-2002
Ubicación: Lima, Peru
Mensajes: 4.619
Antigüedad: 22 años
Puntos: 7
Re: capturar la fecha

Código:
<script language='JavaScript'>
function FXOnLoad() {
  var months=new Array(13);
  months[1]="Enero";
  months[2]="Febrero";
  months[3]="Marzo";
  months[4]="Abril";
  months[5]="Mayo";
  months[6]="Junio";
  months[7]="Julio";
  months[8]="Agosto";
  months[9]="Septiembre";
  months[10]="Octubre";
  months[11]="Noviembre";
  months[12]="Diciembre";
  var time=new Date();
  var lmonth=months[time.getMonth() + 1];
  var date=time.getDate();
  var year=time.getYear();
  if (year < 2000) year = year + 1900;
  var hours = timew.getHours();
  var minutes = time.getMinutes();
  var seconds = time.getSeconds()
  var timeValue = "" + ((hours >12) ? hours -12 :hours)
  if (timeValue == "0") timeValue = 12;
  timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  timeValue += (hours >= 12) ? " P.M." : " A.M."
  document.miform.txtfecha.value=date + " de " + lmonth + ", " + year;
  document.miform.txthora.value = timeValue;
}
</script>
...
<body... onLoad='FXOnLoad();'>
...
<form name='miform'...>
<input type='text' name='txtfecha'...>
<input type='text' name='txthora'...>
....
</form>