如何在php中将日期字段与时间字段连接起来
我需要加入一个日期字段如何在php中将日期字段与时间字段连接起来,php,mysql,date,time,Php,Mysql,Date,Time,我需要加入一个日期字段bid_starting_date和一个时间字段bid_starting_time并检查当前日期时间$current_date_time=date('md,yh:I:s')我如何才能做到这一点 <?php $current_date_time=date('M d,Y H:i:s'); $bid_schedule_date=date('M d,Y',strtotime($row['bid_staring_date'])); $bid_sched
bid_starting_date
和一个时间字段bid_starting_time
并检查当前日期时间$current_date_time=date('md,yh:I:s')代码>我如何才能做到这一点
<?php
$current_date_time=date('M d,Y H:i:s');
$bid_schedule_date=date('M d,Y',strtotime($row['bid_staring_date']));
$bid_schedule_time=date('H:i:s',strtotime($row['bid_staring_time']));
echo $bid_schedule_date_time=date('M d,Y H:i:s',(strtotime($bid_schedule_date)+strtotime($bid_schedule_time)));
$bid_schedule_id=$row['bid_schedule_id'];
if($current_date_time>=$bid_schedule_date_time){
$btn_type="btn btn-success";
$btn_value="Bid Now";
$btn_link="openbid.php?pid=$bid_schedule_id";
}
else
{
$btn_type="btn btn-danger";
$btn_value="Bid Not Started";
$btn_link="#";
}
echo "<a href='$btn_link' class='$btn_type'>$btn_value</a>";
?>
参考资料::
你的问题不清楚。您是否希望此行的连接“(strotime($bid\u schedule\u date)+strotime($bid\u schedule\u time))?将日期和时间存储为单个实体2017-04-22 | 11:56:00 | 00:30:00虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能无效。-对不起,哪个是链接??
$game_date = game['date'];
$game_time = game['time'];
$combined_date_and_time = $game_date . ' ' . $game_time;
$past_date = strtotime($combined_date_and_time);