strtotime($times) 时间戳
$_POST[times] 表单里面填写的是20130525100000
如何让他提交到数据库是1369447200 时间戳我做了一个预约挂号程序,里面可以指定预约时间,提交表单格式为20130525100000 这种类型的,如何让他提交之后变成 1369447200 这种时间戳类型的呢?
$_POST[times] 表单里面填写的是20130525100000
如何让他提交到数据库是1369447200 时间戳我做了一个预约挂号程序,里面可以指定预约时间,提交表单格式为20130525100000 这种类型的,如何让他提交之后变成 1369447200 这种时间戳类型的呢?
<?php
include("conn.php");
if($_POST['submit'])
{
$sql="INSERT INTO `pinphp`.`ftxia_items` (`id`, `coupon_start_time`, `coupon_end_time`)" .
"values ('NULL','$_POST[coupon_start_time]','$_POST[coupon_end_time]')";
mysql_query($sql);
echo "";
}
$times='20130525100000';
echo strtotime($times);
?>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style>
<form name="myform" action="add.php" method="post" onsubmit="return checkpost();">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr>
<td width="79" height="34" align="center" bgcolor="#FFFFFF">ordid:自定义排序999</td>
<td width="518" bgcolor="#FFFFFF"><input name="ordid" type="ordid" id="ordid" size="40" />
</label></td>
</tr> <tr>
<td height="43" align="center" bgcolor="#FFFFFF">coupon_start_time:开始时间</td>
<td height="43" bgcolor="#FFFFFF"><input name="coupon_start_time" type="coupon_start_time" id="coupon_start_time" size="40" /></td>
</tr>
<tr>
<td height="43" align="center" bgcolor="#FFFFFF">coupon_end_time:结束时间</td>
<td height="43" bgcolor="#FFFFFF"><input name="coupon_end_time" type="coupon_end_time" id="coupon_end_time" size="40" /></td>
</tr> <tr>
<td height="55" colspan="2" align="center" bgcolor="#FFFFFF"><label>
<input type="submit" name="submit" id="button" value="提交">
</label></td>
</tr>
</table>
</form>
代码