【发布时间】:2015-12-31 09:24:43
【问题描述】:
在我的数据库中,当我插入使用 strtotime 转换为时间戳的日期和时间时,它就像“1444600800”,而且我还有一个转换为同一进程“1443740700”的特定服务的持续时间,现在我我在日历事件中使用https://github.com/almasaeed2010/AdminLTE,其'http://fullcalendar.io/,它的编码如下:
events: [
{
title: 'All Day Event',
start: new Date(y, m, 1),
end: new Date(y, m, d, 13, 30),
backgroundColor: "#f56954", //red
borderColor: "#f56954" //red
} ]
我是这样编码的,但没有成功:
events:
[
<?php $event_query = mysql_query("select *,TIME_FORMAT (`appoint_date`, '%H:%i') from appointment INNER JOIN 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)){
?>
{
title : '<?php echo $event_row['firstname']; ?> ',
start : <?php echo $event_row['appoint_date']; ?>,
end : <?php echo $event_row['duration']; ?>,
allDay: false,
backgroundColor: "#3c8dbc", //Primary (light-blue)
borderColor: "#3c8dbc" //Primary (light-blue)
},
<?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";`
怎么办?
【问题讨论】:
标签: javascript mysql timestamp fullcalendar strtotime