Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

179
Vistas
How to find the difference between two dates with format dd/mm/yyyy in JavaScript in Keyup Event of date2 textbox

I have two date in html Datefrom and Dateto input text with ddmmyyyy format. I am trying to find out the difference between Datefrom and Dateto in Keyup event of Datefrom.

<input type='text' asp-for="Datefrom " class="form-control " id="Datefrom " />
<input type='text' asp-for="Dateto " class="form-control " id="Dateto " />

I am trying to find out the difference between two date in JavaScript as given below. The difference is not showed as correctly.

<script>

$("#Datefrom").datepicker({ format: 'dd/mm/yyyy', date: new Date(1900, 01, 01), autoclose: true, todayBtn: 'linked' });
$("#Dateto").datepicker({ format: 'dd/mm/yyyy', date: new Date(1900, 01, 01), autoclose: true, todayBtn: 'linked' });
     $('#Datefrom ').keyup(function () {
                 
         var stdatestring = $('#Datefrom').val();
         var missdatestring = $('#Dateto').val();
         var stdateval = moment(stdatestring, 'DD/MM/YYYY').toDate();
         var datefromval = moment(missdatestring, 'DD/MM/YYYY').toDate();
         var diffdate = missdatestring - stdatestring 
    
      });

</script>
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda