Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/10/2015, 14:35
MrGilbertMan
 
Fecha de Ingreso: enero-2015
Ubicación: Cordoba, Andalucía
Mensajes: 111
Antigüedad: 9 años, 4 meses
Puntos: 15
Respuesta: Sumar dias a una fecha

Prueba esto, yo no lo he probado, igual tienes que hacer algún arreglo.

Código Javascript:
Ver original
  1. <script>
  2.  
  3.     fecha=new Date();
  4.     day=fecha.getDate();
  5.     month=fecha.getMonth()+1;
  6.     year=fecha.getFullYear();
  7.  
  8.     document.getElementById('fecha1').value=day+"/"+month+"/"+year;
  9.      
  10.     tiempo=fecha.getTime();
  11.     //sumar dos días en milisegundos
  12.     milisegundos=parseInt(2*24*60*60*1000);
  13.     //Modificamos la fecha actual
  14.     total=fecha.setTime(tiempo+milisegundos);
  15.     day=fecha.getDate();
  16.     month=fecha.getMonth()+1;
  17.     year=fecha.getFullYear();
  18.  
  19.     document.getElementById('fecha2').value=day+"/"+month+"/"+year;
  20.  
  21. </script>