www.webdeveloper.com
Results 1 to 4 of 4

Thread: time

  1. #1
    Join Date
    Jun 2003
    Posts
    181

    time

    Hi,

    is anybody knows how i can get time(system),when i clicks on button(now)
    <?
    function fillDD($min, $max, $selected)
    {
    for($i=$min; $i<24; $i++) {
    $i = sprintf('%02d', $i);
    for($j=$max; $j<60; $j+=5) {
    $j = sprintf('%02d', $j);
    if($i == $selected && $j == $selected) {
    print("<option SELECTED value='$i:$j'>$i:$j</option>\n");
    }
    else {
    print("<option value='$i:$j'>$i:$j</option>\n");
    }
    }//for($j)
    } //for($i)
    }

    ?>
    <td>
    <select name="time" size="1">
    <? fillDD(0, 0, -1); ?>
    <input type="button" size="1" name="now">
    </select>
    </td>
    is it possible with PHP that when i click this button i will get system time in this select field

    thanks in advance

  2. #2
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104

    Re: time

    Originally posted by zuzupus
    is it possible with PHP that when i click this button i will get system time in this select field
    The only time you can get with PHP is the server time (as it runs server-side). If you want the client time, you will need to use javascript.

  3. #3
    Join Date
    Jun 2003
    Posts
    181

    Re: Re: time

    thanks so how i can use javascript so that when i click on button system will dispay on select field i can call the function on this button now but it will show soem alert i just want to display in select field when this button is clicked as i have seen some websites they r using button to get present time

    var now = new Date();
    function a(){
    alert(now.getHours()+":"+now.getMinutes()+":"+now.getSeconds());
    }

    i will really appreciate if you provide the solution

  4. #4
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    Answered in the javascript forums: http://forums.webdeveloper.com/showt...6610#post66610

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