Forums

PHP

This topic is locked

Current time

Posted 06 Jun 2002 13:51:35
1
has voted
06 Jun 2002 13:51:35 Julio Taylor posted:
What PHP code do i need to use to display the current server time as a form item's defaul value? (similar to now() in MSaccess).... i don't want to use a timestamp field, i was the user to see the current date and store it as a text field.

Thanks!

Replies

Replied 06 Jun 2002 17:35:46
06 Jun 2002 17:35:46 Aurel Sorin Cirstoiu replied:
Make a function like this:

function getTime()
{
$today = getdate();
$hours = $today['hours'];
$minutes = $today['minutes'];
$seconds = $today['seconds'];

return $hours.":".$minutes.".".$seconds;
}

In the form you will do like this:
<input type="text" name="time" value="<?php echo getTime() ?>">

-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro

Edited by - csorin on 06 Jun 2002 17:37:10

Reply to this topic