Javascript 如何在DateTime时间戳中添加时间时间戳?
我有一个项目,我有一个特定服务的持续时间,我已经转换成strotime,还有一个日期时间选择器,我已经转换成strotime,所以在我的数据库中,我使用一个日历 现在,这是我的问题,在日历示例中有代码Javascript 如何在DateTime时间戳中添加时间时间戳?,javascript,php,datetime,twitter-bootstrap-3,timestamp,Javascript,Php,Datetime,Twitter Bootstrap 3,Timestamp,我有一个项目,我有一个特定服务的持续时间,我已经转换成strotime,还有一个日期时间选择器,我已经转换成strotime,所以在我的数据库中,我使用一个日历 现在,这是我的问题,在日历示例中有代码 { title: 'Long Event', start: new Date(y, m, d - 5), end: new Date(y, m, d -
{
title: 'Long Event',
start: new Date(y, m, d - 5),
end: new Date(y, m, d - 2),
backgroundColor: "#f39c12", //yellow
borderColor: "#f39c12" //yellow
},
我试图实现的是,从服务持续时间,假设持续时间是2小时转换的strotime,我如何将其添加到datetime的时间戳中?下面是我的代码和屏幕截图,正如你所看到的,结果是非常错误的,因为我的约会结束时间只有2小时,但约会显示了几天
事件:
[
{
标题:“”,
开始:“”,
结束:“”,
全天:错,
背景色:“#3c8dbc”//原色(浅蓝色)
边框颜色:“3c8dbc”//Primary(浅蓝色)
},
],
开始日期还可以,只是结束,因为我只在服务时间戳和日期时间戳之间添加了2个小时,怎么办?PHP Time函数:
time()代码>
这段代码返回:
现在:2005-03-30
下周:2005-04-06
下周:2005-04-06
有关更多信息,请参阅
events:
[
<?php $event_query = mysql_query("select * from appointment,service,user where appointment.user_id = user.user_id and service.service_id = appointment.service_id")or die(mysql_error());
while($event_row = mysql_fetch_array($event_query)){
$e = $event_row['appoint_date'];
$ee = $event_row['appoint_end'];
$eee = $e + $ee;
?>
{
title : '<?php echo $event_row['firstname'].' '.$event_row['lastname']; ?> ',
start : '<?php echo $event_row['appoint_date']; ?>',
end: '<?php echo $eee; ?>',
allDay: false,
backgroundColor: "#3c8dbc", //Primary (light-blue)
borderColor: "#3c8dbc" //Primary (light-blue)
},
<?php } ?>
],
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
// 7 days; 24 hours; 60 mins; 60 secs
echo 'Now: '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
// or using strtotime():
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>