/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@pyroJul 07.2003 — [i]Originally posted by zuzupus [/i]

[B]is it possible with PHP that when i click this button i will get system time in this select field[/B][/QUOTE]
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.
Copy linkTweet thisAlerts:
@zuzupusauthorJul 07.2003 — 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
×

Success!

Help @zuzupus spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...