从全日历中获取选定的日期

2024-05-01

我将日历添加到我的 asp.net mvc 2 应用程序中here http://arshaw.com/fullcalendar/ .

我想选择参加活动的选定日期。我怎样才能获得选定的日期?

我还想将此日期和相应的事件保存到数据库中。这还怎么办?


设置插件时使用此代码

$('#calendar').fullCalendar({
    selectable: true,
    select: function(start, end, jsEvent, view) {
         // start contains the date you have selected
         // end contains the end date. 
         // Caution: the end date is exclusive (new since v2).
         var allDay = !start.hasTime() && !end.hasTime();
         alert(["Event Start date: " + moment(start).format(),
                "Event End date: " + moment(end).format(),
                "AllDay: " + allDay].join("\n"));
    }
});
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.print.css" rel="stylesheet" media="print"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.1.1/fullcalendar.min.js"></script>
<div id="calendar"></div>

请注意,我刚刚提供了回答您的问题所需的选项。

欲了解更多信息,请参阅非常好的制作插件文档 http://fullcalendar.io/.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

从全日历中获取选定的日期 的相关文章