Reputation: 1281
I have this function:
CODE JS:
select: function(start, end, allDay)
{
addEditEvent("select",event,start,end);
},
function addEditEvent(state,event,start,end)
{
if(state=="select")
{
console.log(start._d); //here display in this format Fri Feb 19 2016 04:00:00 GMT+0200 (EET)
}
}
I want to transform this format in
YYYY-MM-DD
How can I turn this time? Can you help me to solve this problem?
Thanks in advance!
Upvotes: 1
Views: 3119
Reputation: 1465
Try this
Use moment for format as fullcalendar use moment library for date.
No need of _d just start
select: function(start, end, allDay)
{
addEditEvent("select",event,start,end);
},
function addEditEvent(state,event,start,end)
{
if(state=="select")
{
console.log(moment(start).format('YYYY-MM-DD'));
}
}
Upvotes: 2
Reputation: 6264
titleFormat: {
day: 'dddd, d MMM, yyyy' //whatever date format you want here
}
Upvotes: 1