如何从 jQuery UI datepicker 获取日期 [英] How to get the date from jQuery UI datepicker

查看:33
本文介绍了如何从 jQuery UI datepicker 获取日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当用户在 jQuery UI datepicker 中选择日期并单击表单上的按钮时,我都想从 datepicker 获取日期.

I want to get the date from datepicker whenever user choose the date in jQuery UI datepicker and click the button on the form.

好吧,我需要获取他们选择的日期的日、月和年.我如何获得日期形式的 jQuery UI?

well I need to get the day, month and year of the date they choose. How can I get the date form jQuery UI?

推荐答案

使用

var jsDate = $('#your_datepicker_id').datepicker('getDate');
if (jsDate !== null) { // if any date selected in datepicker
    jsDate instanceof Date; // -> true
    jsDate.getDate();
    jsDate.getMonth();
    jsDate.getFullYear();
}

这篇关于如何从 jQuery UI datepicker 获取日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆