0

all I'm using fullcalendar, but I didn't undestood how can I change the Date format of arg.start /arg.end in the YYYY-MM-DD, who can help me?

I'musing Fullcalendar 4.4.0 Best Regards Albe

select: function(arg) {

    var title = prompt('Event Title:');
    var start = '2020-04-17';
    var end = '2020-04-17'; 


      if (title) {
        calendar.addEvent({
          title: title,
          start: arg.start,
          end: arg.end,
          allDay: arg.allDay
        });

        var tt = calendar.formatDate(arg.start, {
            year: 'numeric',
            month: '2-digit',
            day: 'numeric'
          });


        $.ajax({
            url: 'insert.php',
            type: "POST",
            data: {title:title, start:start, end:end, tt:tt },
            dataType: 'html',
            success: function (msg) {
                alert(msg);
            }
        })
      }
      calendar.unselect()
    },
  • my advice would be to use something like [momentJS](https://momentjs.com/docs/#/displaying/format/) to format the date. – ADyson Apr 15 '20 at 18:55
  • So is your issue how to create a timestamp in YYYY-MM-DD format? If so, there are already [many questions on formatting a date](https://stackoverflow.com/search?q=%5Bjavascript%5D+how+to+format+a+date), e.g. [*How to format a JavaScript date*](https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date?r=SearchResults&s=1|1449.3378). – RobG Apr 16 '20 at 02:35

0 Answers0