我有下面的代码,其中包含日期。将日期转换为时间戳格式
echo $giorno_selcted;
$post_date = date("Y-m-d", strtotime(stripslashes($giorno_selcted)));
$ giorno_selected //这种格式相呼应日期25-09-2012 $ POST_DATE //创建格式年月日的日期 - 2012年9月25日
我需要的是创建两个变量,将$ POST_DATE转换为时间戳,即2012年9月25日00:00和2012年9月25日23:59:59
$post_date_start = 2012-09-25 00:00:00
$post_date_finish = 2012-09-25 23:59:59
谢谢!
我有这个查询,它允许我打印两个时间戳之间插入的所有信息。但是,在我的语法中出现错误, 您的SQL语法错误;检查对应于你的MySQL服务器版本正确的语法附近'00使用手册:00:第1行
这里00和”是代码:
$post_date = date("Y-m-d", strtotime(stripslashes($giorno_selcted)));
$time_end = "23:59:59";
$time_start = "00:00:00";
$giorno_timestamp_start=$post_date.' '.$time_end;
$giorno_timestamp_start=$post_date.' '.$time_start;
$information="SELECT * FROM scheda_anagrafica WHERE time_inserted BETWEEN " . $giorno_timestamp_start. " AND ". $giorno_timestamp_end;
的time_inserted fieldis作为时间戳现场.. 感谢
只是时代串联到字符串值输出。 '$ post_date。 “00:00:00”,$ post_date。 “23:59:59”' –
你可以在unix时间戳值中添加86399,然后调用'date('Y-m-d H:i:s')',但这不是必需的。 –
谢谢:) 我修好了 –