完整日历Google活动的开始/结束格式

use*_*546 1 google-calendar-api fullcalendar

我使用完整日历在网页上显示一些Google日历.当用户将鼠标悬停在日历上的事件上时,我添加了qTip,以显示完整的事件详细信息(位置,描述等).我希望qTip显示事件的开始/结束时间,格式为:

日期,日期月,开始时间 - 结束时间

与24小时制的时间.

如果我添加event.start和event.end我qTip,然后出现在开始和结束时间,而不是格式正确无误.我想我需要使用formatdate函数,但我无法弄清楚如何.有人可以帮忙吗?我粘贴了下面的代码.

<script type='text/javascript'>                     

$(document).ready(function() {
$('#calendar').fullCalendar({
       eventRender: function(event, element) {
        element.qtip({
            content: '<b>' + event.title + event.start +' - ' + event.end + '</b><br><br>LOCATION: ' + event.location + '<br><br> AVAILABILITY: ' + event.description
        })
    },
    eventSources: { 
    url: 'my calendar URL'
    }
});
});
</script>
Run Code Online (Sandbox Code Playgroud)

Sly*_*ain 8

FullCalendar的最新版本包括Moment.js,您可以格式化您的时间,如下所示:

var start = moment(event.start).format("DD-MM-YYYY HH:mm");
Run Code Online (Sandbox Code Playgroud)

更多信息:

http://momentjs.com/docs/#/parsing/string-format/

http://arshaw.com/fullcalendar/docs/utilities/Moment/