Results 1 to 2 of 2

Thread: timedifference between 2 clocks

  1. #1
    Join Date
    Jun 2003

    timedifference between 2 clocks


    I created two Fields which showing time
    One field is From which is combo so that use can select
    the time and another field To is Clock as in PHP wont refresh clock so i used javascript for that. another field is to get the time difference beiween these two fields.

    anybody knows how to calculate the time difference which will show automatically in third field,i mean to say i dont have to click in any of from and to fields.

    PHP Code:
    function fillDD($min, $max, $selected)
       for($i=$min; $i<24; $i++)
           for($j=$max; $j<60; $j+=5)
             if($i == $selected && $j == $selected)
                 if ($i < 10) {
        print("<option SELECTED value='$i:$j'>0$i:$j</option>\n");
            } else {
          print("<option SELECTED value='$i:$j'>$i:$j</option>\n");
                              if ($i < 10) {
                      print("<option value='$i:$j'>0$i:$j</option>\n");
                                } else {
                      print("<option value='$i:$j'>$i:$j</option>\n");
                        } //for($i)
    <select name="From" size="1" onFocus="calculateIst()">
    <option selected value="<?=date('H:i')?>"><? echo (date('H:i')); ?></option>
    <? fillDD(80, -1); ?>
    <input type="text" size="2" class="button" name="bis" readonly>
    <input size="1" class="button" type="text" value="0" name="Time Diff" readonly></td>

    <SCRIPT language="JavaScript">
            function show(){
              var Digital=new Date()
              var hours=Digital.getHours()
              var minutes=Digital.getMinutes()

              if (hours==0)
              if (minutes<=9)
    How i can get the time diff. in 3rd field without clicking on any of the fields is it possible,if not then what to do

    thanks in advance

    arun krishnan

  2. #2
    Join Date
    Dec 2002
    High on life
    What exactly are you trying to do? It would help if you explain what you need better. Try looking into mktime. This will give you a Unix timestamp, which is easily compared...

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles