I want to store a date to which certain days were added, with the function setDate()
, Example: 28/02/2018
+ 1 day = 01/3/2018
.
So add a if
and add the 0
but at the time of storing it does not work
fecha_termino.setDate(fecha_termino.getDate() + diasNum);
//alert(fechaDate.getDate() + '/' + (fechaDate.getMonth() + 1) + '/' + fechaDate.getFullYear());
if((fecha_termino.getMonth() + 0) < 10)
{
$('#TFecha_termino').val(fecha_termino.getDate() + '/' + '0' +(fecha_termino.getMonth() + 1) + '/' + fecha_termino.getFullYear());
}
else
{
$('#TFecha_termino').val(fecha_termino.getDate() + '/' + (fecha_termino.getMonth() + 1) + '/' + fecha_termino.getFullYear());
}