PHP 示例
<?
prinr_r($_GET);
$after = // Convert $_GET['after'] to unixtime
$before = $after + 86400;
$before2 = // Convert to HTML5 date type ($before);
?>
<form action=''>
<input type='date' name='time_after'>
<input type='date' name='time_before' value='<?=$before2?>'>
<input type='submit' value='send'>
</form>
将 unixtime 转换为 HTML5 日期或将 HTML5 转换为 unixtime 有多简单?一条线)
PS请简单地帮助这个:
$t1 = explode('-',$_GET['after']);
$t2 = explode('-',$_GET['before']);
if($t1[2]){
$t1 = mktime(0,0,0,(int)$t1[1],(int)$t1[2],$t1[0]);
}else{
$t1 = mktime(0,0,0,date('n'),date('j'),date('Y'))-2592000;
}
if($t2[2]){
$t2 = mktime(23,59,59,(int)$t2[1],(int)$t2[2],$t2[0]);
}else{
$t2 = mktime(23,59,59,date('n'),date('j'),date('Y'));
}