开发者

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>


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

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

Date Function


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.


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") ?>">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜