jquery datepicker getting dateText out of onSelect event
want to get dateText from datepicker out of onSelect event, in some other function:
example:
when in onSelect event:
dateText is equal to 08.02.2011
$('#datetime').datepicker("getDate") returns:
Tue Feb 08 2011 00:00:00 GMT+0300 (Russia Standard Time)
so it can not enter t开发者_运维百科o my controller properly
Datepicker getDate method return Date object (Date object reference) you need to convert it
function convert(date) {
return date.getDate() + "."+ (date.getMonth()+1) + "." + date.getFullYear();
}
You can also try to overwrite toString method of Date object, but I don't know how this will work with DatePicker plugin.
Date.prototype.toString = function() {
return this.getDate() + "."+ (this.getMonth()+1) + "." + this.getFullYear();
}
精彩评论