user225269
user225269

Reputation: 10893

time function in php

Somehow I managed to make the date work,

<td width="67"><font size="3"><b>*Date</b></td>
<td width="3">:</td>
<td width="168"><input name="adate" type="text" id="adate" maxlength="20" value="<?php  echo date("Y/m/d") . "<br />"; ?>">

how do I echo the time in this form:

  <td width="67"><font size="3"><b>*Time</b></td>
    <td width="3">:</td>
    <td width="168"><input name="adtime" type="text" id="adtime" maxlength="15">

    </td>

Upvotes: 0

Views: 116

Answers (3)

Michael D. Irizarry
Michael D. Irizarry

Reputation: 6302

My advice if your programming in PHP go with a framework like CodeIgniter, CakePHP or Zend. Just dont code from scratch out of thin air unless you actually need to.

Upvotes: 1

Cetra
Cetra

Reputation: 2621

Depends on what format you want for the time.

the php date() function has a number of different ways of representing time. If you just want HH:MM:SS you could do this:

<td width="168"><input name="adtime" type="text" id="adtime" maxlength="15" value="<?php  echo date("H:i:s") ?>">

Upvotes: 0

Marcx
Marcx

Reputation: 6836

simply use the date function but with hour/min/seconds output..

echo date('H:i:s');

Date Function

Upvotes: 2

Related Questions