Pages

Tuesday 2 December 2014

Change date formate of Jquery datepicker in mvc4

Following Code is used to change jquery date picker formate to accept the date as "dd/mm/yy" format instead of any other formate.

$(function () { $.validator.addMethod('date', function (value, element) { if (this.optional(element)) { return true; } var ok = true; try { $.datepicker.parseDate('dd/mm/yy', value); } catch (err) { ok = false; } return ok; }); $(".date").datepicker({ dateFormat: 'dd/mm/yy', changeYear: true }); });

No comments:

Post a Comment