Problems with dates FullCalendar Jquery

0

I'm having trouble with the save date in the bank. So that I can save the date should come like this:

2017-01-09 19:39:12

But it's coming like this:

Thu Jan 05 2017 00:00:00 GMT+0000

The configuration of my fullcallendar looks like this:

    $('#calendar').fullCalendar({
        // put your options and callbacks here
        selectable: true,
        editable: true,
        select: function(start, end, allDay) {
          $("#addEvent").show();
          $("#editEvent").hide();
          $("#addNew-event").modal("show");
          $("#addNew-event input:text").val("");
          $("#getStart").val(start);
          $("#getEnt").val(end);
      },
      eventClick: function(event, element) {
          $("#addEvent").hide()
          $("#editEvent").show().data("ev", event);
          $("#addNew-event").modal("show");
          $("#addNew-event input:text").val("");
          $("#eventName").val(event.title);
      }
  });

What should I do to make these dates effective as I need to save to the bank?

The problem is when I need to reload the data in the API. So there he has to accept the normal format he saves in the bank.

What to do?

    
asked by anonymous 09.01.2017 / 23:50

1 answer

0

I believe the solution is to use moment.js format .

$('#calendar').fullCalendar({
    ...
    select: function(start, end, allDay) {
      ...
      $("#getStart").val(moment(start).format("YYYY-MM-DD HH:mm"));
      $("#getEnt").val(moment(end).format("YYYY-MM-DD HH:mm"));
  }
...
});

There are still other ways to format the date.

    
23.04.2017 / 04:57