你好朋友在我的应用程序中我需要使用FullCalendar.js和anytime.js 那么我怎样才能使两种格式都相同,例如“Tue Apr 02 2013 00:00:00 05:30 (IST)”等等我如何获取数据( eventname,starttime,endtime) 来自数据库,分别显示开始时间和结束时间,如果有任何事件在每天/每周完成特定时间和日期,那么我如何在完整日历中显示以及如果存储在事件中的更改数据库请朋友帮帮我
完整的日历代码:
<script type='text/javascript'>
$(document).ready(function() {
var count=0;
/* initialize the calendar
-----------------------------------------------------------------*/
$('#calendar').fullCalendar({
axisFormat:'HH:mm',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
viewDisplay: function(view) {
if(view.name=="month" && count==0){
var a=$(".fc-day-number").prepend("<img src='/assets/images/add.jpg' width='20' height='20'style='margin-right:80px;' name='date'>");
count++;
}
if(view.name=="agendaDay" || view.name=="agendaWeek"){
$("#popup").hide();
count++;
}
},
slotMinutes:5,
editable: true,
droppable: true, // this allows things to be dropped onto the calendar !!!
timeFormat: 'H(:mm)',
events:"<?php echo base_url();?>data/read",
eventClick : function (calEvent, jsEvent, view){
console.log(calEvent);
},
dayClick : function (date, allDay, jsEvent, view){
console.log(jsEvent);
alert(date);
$("#popup").show();
$("#popup").css({left : jsEvent.clientX, top : jsEvent.clientY});
var getdata = $.getJSON( "data", function() {
console.log( "success" );
})
}
});
});
</script>
anyTime.js 代码:
<script>
$('#startTime').focus(
function(e) {
$('#startTime').AnyTime_picker({format:"%a %b %d %Y %h:%i"}).focus();
e.preventDefault();
});
$('#endTime').focus(
function(e) {
$('#endTime').AnyTime_picker({format:"%a %b %d %Y %T"}).focus();
e.preventDefault();
});
$(function(){
$(".k-button").click(function(){
var eventName=$("#eventName").val();
var startTime=$("#startTime").val();
var endTime=$("#endTime").val();
var dataString={};
dataString['eventName']=eventName;
dataString['startTime']=startTime;
dataString['endTime']=endTime;
if(eventName==""||startTime==""||endTime==""||startTime>endTime)
{
alert("Please Data Enter Properly");
}
else
{
$.ajax({
type : 'POST',
dataType : 'json',
url : '<?php echo base_url();?>data/insert',
data: dataString,
cache:false,
success: function(data) {
if(rsp.success)
alert("Data Insert SuccessFully");
}
});
}
});
});
</script>
html代码:
<div id="popup">
<form name="addData" id="addData" action="" method="post">
<table>
<tr>
<td><lable for="eventName">Description:</lable></td>
<td><input name="eventName" id="eventName"></td>
</tr>
<tr>
<td><lable for="startTime">Start: </td>
<td><input type="text" id="startTime"name="startTime"/></td>
</tr>
<tr>
<td><lable for="endTime">End: </td>
<td><input type="text" id="endTime"name="endTime"/></td>
</tr>
<tr>
<td align="left"colspan="2">
<button type="submit"class="k-button" name="submit" id="submit">Submit</button>
<button type="reset" name="reset" class="k-button" id="reset">Reset</button>
</td>
</tr>
</table>
</form>