gpt4 book ai didi

javascript - jQuery UI 日期格式

转载 作者:行者123 更新时间:2023-11-30 13:28:26 25 4
gpt4 key购买 nike

我有以下带有 UI Datepicker 的脚本,但我需要日期作为我的 URL 中的参数。我似乎无法在 URL 中正确设置日期格式。带有日期的输入框是很好,但是日期没有出现在我的 URL 字符串中..

我需要将 dateText 变量格式化为“yyyy-mm-dd”

<script type="text/javascript">
jQuery(function() {
jQuery('#datepick').datepicker({ dateFormat: "yy-mm-dd" })({
onSelect: function (dateText, inst) {
window.location.href="reports?date=" + dateText;
}
})
});
</script>

谢谢你..

最佳答案

在你的 onSelect 中试试这个:

window.location.href="reports?date=" + $.datepicker.formatDate("yy-mm-dd", $(this).datepicker("getDate"));

关于javascript - jQuery UI 日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7672894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com