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

225
Vistas
Getting date/time difference in ASP.Net Core application

I am new to ASP.Net core. I am doing a simple web application to find the difference between to date/time values. To get the difference I have a java script . But the thing is in the java script I am not able to access the date/time picker controls. I am not sure if what I have done is correct. Could someone please take a look and tell what's the real issue. Is this the correct way to get the difference. ie. I need to get the difference in hh:mm format with the data/time combined. Heres relevant the markup/code I am using.

<html>
<body style="background-color:Highlight">
    <script>
        function onSelectTime() {
          var Start = document.getElementById("startdate").innerHTML+ " " + document.getElementById("starttimme").innerHTML;
          var End = document.getElementById("enddate").innerText + " " + document.getElementById("endtime").innerText;
          var Diff = End - Start;
            document.getElementById("practicetime").innerHTML = Diff.toString();
        }
    </script>
    <div class="text-center">        
        <label style="color:white">Start Date</label>
        <input type="date" id="startdate" name="startdate" value="@DateTime.Now.ToString("yyyy-MM-dd")" />
        <label style="color:white" id="lblstarttime">Start Time</label>
        <input type="time" id="starttime" name="starttime" value="@DateTime.Now.ToString("hh:mm")" />
        <br />
        <br />
        <label style="color:white">End Date</label>
        <input type="date" id="enddate" name="enddate" value="@DateTime.Now.ToString("yyyy-MM-dd")" />
        <label style="color:white">End Time</label>
        <input type="time" id="endtime" name="endtime" value="@DateTime.Now.ToString("hh:mm")" />
        <br />

        <br />
        <button  onClick="onSelectTime()">Click</button>
    </div>
</body>
</html>

enter image description here

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