jQuery比较数组输入字段

I am creating a Weekly Timeslot.So far I have completed all the functionalities.But I need to compare the times.I don't know how to do.Please help..

<table class = "widefat">
    <thead>
        <tr>
            <th>Day of Week</th>
            <th>Office Hours</th>
            <th>Lunch Time</th>
            <th>Day off</th>
        </tr>
    </thead>
        <?php
        $days = array(
                      "1" => "SUN",
                      "2" => "MON",
                      "3" => "TUE",
                      "4" => "WED",
                      "5" => "THU",
                      "6" => "FRI",
                      "7" => "SAT");
        foreach($days as $key => $value){
            $val=$value;
            $obj = data($val);
        ?>
            <tr>
                <td>
                    <?php echo $value ;?><input type ="hidden" name ="day[<?php echo $key ?>]" value=<?php echo $value; ?> class="day_week"/>
                </td>
                <td>
                    From <input type = "text" name="wk_from[<?php echo $key ?>]" id="office_hours_from_<?php echo $key; ?>" class ="working_from" value="<?php echo $obj['office_hour_from']; ?>" style="width:6em">
                    To   <input type = "text" name="wk_to[<?php echo $key ?>]" id="office_hours_to_<?php echo $key; ?>" class ="working_to" value="<?php echo $obj['office_hour_to']; ?>" style="width:6em">
                </td>
                <td>
                    From <input type = "text" name="lunch_from[<?php echo $key ?>]" id="lunch_hours_from_<?php echo $key; ?>" class ="break_from" value="<?php echo $obj['break_hour_from']; ?>" style="width:6em">
                    To   <input type = "text" name="lunch_to[<?php echo $key ?>]" id="lunch_hours_to_<?php echo $key; ?>" class ="break_to" value="<?php echo $obj['break_hour_to']; ?>" style="width:6em">
                </td>
                <td>
                    <?php
                        if($obj['day_off']==1){ ?>
                            <input type = "checkbox" name ="day_off[<?php echo $key ?>]" value="1" id="<?php echo $key; ?>" checked="checked" class="check_day_off">
                        <?php }else{ ?>
                            <input type = "checkbox" name ="day_off[<?php echo $key; ?>]" value="1" id="<?php echo $key; ?>"  class="check_day_off">
                        <?php   }
                    ?>
                    <input type ="hidden" name="doc_id" value="<?php echo get_current_user_id; ?>">
            <!--    <input type = "checkbox" name ="day_off[]" value" id="<?php //echo $key; ?>" class="check_day_off"?>-->
                </td>
            </tr>
    <?php   
    }

        ?>

</table>

In this I have to compare the TO time of OfficeHours must be greater than From time.How can I do this comparision for each day.will that be done in jquery?Please Help.thanks in Advance..

I assume you want to check this in daily basis, below code should works:

$("#compare_time").click(function(){
    //take the hours and minutes
    var time_1 = $("#office_hours_from").val().substring(0,5).split(":");
    var time_2 = $("#office_hours_to").val().substring(0,5).split(":");

    //convert it to minutes
    var time_minute_1 = time_1[0] * 60 + time_1[1];
    var time_minute_2 = time_2[0] * 60 + time_2[1];

    //if it's "pm" then add 12 hours to the minute variable
    if($("#office_hours_from").val().substring(5,2) == "pm")
        time_minute_1 += 12 * 60;
    if($("#office_hours_to").val().substring(5,2) == "pm")
        time_minute_2 += 12 * 60;

    if(time_minute_2 >= time_minute_1)
        alert("valid");
    else
        alert("not valid");
});

Check out this Fiddle...

Just use this code to compare dates in php i hope it helps you :)

if( strtotime($date1) > strtotime($date2) )
{   
    echo "Date 1 is Greater than date2"; 
}

in javascript like this

if ( Date.parse('01/01/2011 10:20') > Date.parse('01/01/2011 5:10') )
{
   //do something
}

January is arbitrary date