在我的數據庫中,當我插入使用strtotime轉換爲時間戳的日期和時間時,它就像「1444600800」,我也有一段時間爲某個服務轉換爲相同的過程,「1443740700」,現在我使用https://github.com/almasaeed2010/AdminLTE,以其http://fullcalendar.io/,在日曆事件,它被編寫這樣一個事件:如何在Unix時間戳中提取月份,日期,年份,小時?
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 } ?>
]
我想提取時間戳中的日期,月份,小時,我可以添加我的timesta的小時值從服務持續時間到日期和時間時間戳,並將其編碼爲樣本。用公式:
該怎麼辦?
嘿,是的,我想你可以像這樣添加三個零... :-) –
如何提取持續時間並將其添加到時間戳?所以我可以將其結果插入到最後:? –