Time Duration problem for 12 hrs format
<p>I am getting the time duration correctly for 24 hrs format but for 12 hrs format I am getting error if i give 11:00 am to 1:00 pm. If I give 10:00 am to 11:00 am it will correctl and if I give 6:00 pm to 7:00 pm it will give correctly only in am to pm i m facing problem.</p>

<pre><code>function autoChangeDuration() {
    var diff1 = "00:00";
    var start = document.getElementById("startTime").value;

    var end = document.getElementById("endTime").value;

    if (start &gt; end) {
        document.getElementById("duration").value = diff1;
    } else {
        var space1 = start.split(' ');
        var space2 = end.split(' ');

        s = space1[0].split(':');
        e = space2[0].split(':');

        var diff;

        min = e[1] - s[1];
        hour_carry = 0;

        if (min &lt; 0) {
            min += 60;
            hour_carry += 1;
        }

        hour = e[0] - s[0] - hour_carry;
        diff = hour + ":" + min;
        document.getElementById("duration").value = diff;
    }
</code></pre>
