I am using the FullCalendar script and am having trouble formatting the date/time of EVENTS on the calendar.
I need all the events date/time data to look like:
2011-09-28 08:15:00
All the dates are like this in my JSON source, which display on the calendar correctly. However, if the event is moved or a new event is added (dropped by eternal dragging), the time format looks like:
Fri Sep 30 2011 14:30:00 GMT-0400 (EDT)
It doesn’t DISPLAY in that format, but it appears this way when I try to insert the event.start or event.end into my database, or when I do this:
eventClick: function(event) {
alert("Event ID: " + event.id + " Start Date: " + event.start + " End Date: " + event.end);
}
I am using this only to see how the date & time are saved within the calendar. I need to update my database with new events, but in the format first shown above, but I am having trouble doing this.
How do I use the formatDate function? I see it listed, and the reason I’m asking is because I don’t know what to do with it.
I did:
$.fullCalendar.formatDate(event.start, 'MM-dd-yyyy');
but that doesn’t do anything…
what I did, is, first put it in a var, but only seemed to work in IE – FF still produced the IETF format (ex: “Wed, 18 Oct 2009 13:00:00 EST”):