开发者

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();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜