Reputation: 6450
I'm trying to extract a short date ('m/d/yy'
) from jQuery Datepicker, but I have been unsuccessful. I've tried formatDate
, dateFormat
, parseDate
, but still cannot get a short date format on the server side.
I created a Fiddle that I extracted and modified from one of the other threads on here.
It's my understanding that there's 2 different things we are dealing with in regards to jQuery UI Datepicker:
Wed May 13 2015 00:00:00 GMT-0400
(Eastern Daylight Time)
doesn't work for me.I understand that it's possible to convert the date to a string and format it that way, however I didn't know if it was possible within the jQuery UI library.
Upvotes: 1
Views: 494
Reputation: 21150
Using jQuery UI, you can do:
$.datepicker.formatDate('m/d/yy', yourDate); // where yourDate is the date variable
So in the jsFiddle this would become:
observable($.datepicker.formatDate('m/d/yy',$el.datepicker("getDate")));
See the demo (use datepicker to see the effect) for the results:
Upvotes: 1