jquery datepicker从onSelect事件中获取dateText

jquery datepicker从onSelect事件中获取dateText,jquery,asp.net,asp.net-mvc-2,Jquery,Asp.net,Asp.net Mvc 2,要在其他函数中从onSelect事件的datepicker中获取dateText: 例如: 在onSelect事件中: dateText is equal to 08.02.2011 $('#datetime')。日期选择器(“getDate”)返回: 所以它不能正确地进入我的控制器日期选择器getDate方法return Date对象(),您需要转换它 function convert(date) { return date.getDate() + "."+ (date.getMont

要在其他函数中从onSelect事件的datepicker中获取dateText:

例如:

在onSelect事件中:

dateText is equal to 08.02.2011
$('#datetime')。日期选择器(“getDate”)返回:


所以它不能正确地进入我的控制器

日期选择器getDate方法return Date对象(),您需要转换它

function convert(date) {
   return date.getDate() + "."+ (date.getMonth()+1) + "." + date.getFullYear();
}
您也可以尝试覆盖Date对象的toString方法,但我不知道DatePicker插件将如何工作

Date.prototype.toString = function() {
   return this.getDate() + "."+ (this.getMonth()+1) + "." + this.getFullYear();
}
Date.prototype.toString = function() {
   return this.getDate() + "."+ (this.getMonth()+1) + "." + this.getFullYear();
}