Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!