Formating start_date, end_date in the addEvent event_object

Using the following code:
function onEventAdded(event_id,event_object){
alert('The eventID is ‘+event_id+’ and the event start is ‘+event_object.start_date+’ and the event end is ‘+event_object.end_date+’ and the event text is '+event_object.text);
}

I get the following results:
The eventID is 1317232401295 and the event start is Wed Sep 28 2011 05:05:00 GMT-0400 (Eastern Daylight Time) and the event end is Wed Sep 28 2011 07:15:00 GMT-0400 (Eastern Daylight Time) and the event text is New event

so event_object.start_date = Wed Sep 28 2011 05:05:00 GMT-0400 (Eastern Daylight Time)
I would like it to = 2011-09-28 05:05:00

How do I get it to do that?

I tried using the following code, but I get a date.split not defined error:
function onEventAdded(event_id,event_object){
var format = scheduler.date.str_to_date("%Y-%m-%d %H:%i");
alert('The eventID is ‘+event_id+’ and the event start is ‘+format(event_object.start_date)+’ and the event end is ‘+event_object.end_date+’ and the event text is '+event_object.text);
}

I have been at this for 3 days now. Any help would be greatly appreciated.

I think the main problem is that you need to look up the scheduler’s event instead of using the native event in the onEventAdded handler.

The following code works for me.

function onEventAdded(event_id, native_event) {
  var event = scheduler.getEvent(event_id);
  var format = scheduler.date.date_to_str("%Y-%m-%d %H:%i");
  var msg = 'The eventID is '+event.id+' and the event start is '+format(event.start_date)+' and the event end is '+format(event.end_date)+' and the event text is '+event.text;
  console.log(msg);
}

and displays the following:

How would that work in a recurring control.

If you need to convert date to string - date_to_str need to be used

For recurring event you need to use getRecDates API to get instances of event

Thank you, thank you, thank you!!
It works great!