format date with bootstrap datepicker

时间:2016-04-21 22:14:32

标签: javascript jquery bootstrap-datetimepicker

I'm getting data that is coming from an ajax call and I would like to format it before inserting it into an input field. However, i'm getting it from mysql in this format 1978-03-94 00:00:00

I've tried a bunch of things with javascripts new Date() but to no luck. I also have bootstrap datetimepicker plugin that I can use, I also tried

var dueDate = $.datepicker.formatDate('MMMM D, YYYY', new Date(taskData.due_date));

but it says cannot .formatDate of undefined. I think it doesnt like that i'm feeding it the time as well.

I would like to format the date to this format April 21, 2016 or 'MMMM D, YYYY' - in datepicker.

Any help is appreciated!

0 个答案:

没有答案