Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jqueryui日期格式_Javascript_Jquery_User Interface_Datepicker - Fatal编程技术网

Javascript jqueryui日期格式

Javascript jqueryui日期格式,javascript,jquery,user-interface,datepicker,Javascript,Jquery,User Interface,Datepicker,我有以下带有UI日期选择器的脚本,但我需要在URL中将日期作为参数。。我似乎无法在URL中正确设置日期格式。。带有日期的输入框很好,但日期没有显示在我的URL字符串中 我需要将dateText变量格式化为“yyyy-mm-dd” jQuery(函数(){ jQuery('#datepick').datepicker({dateFormat:'yy-mm-dd})({ onSelect:函数(日期文本,inst){ window.location.href=“reports?date=“+dat

我有以下带有UI日期选择器的脚本,但我需要在URL中将日期作为参数。。我似乎无法在URL中正确设置日期格式。。带有日期的输入框很好,但日期没有显示在我的URL字符串中

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


jQuery(函数(){
jQuery('#datepick').datepicker({dateFormat:'yy-mm-dd})({
onSelect:函数(日期文本,inst){
window.location.href=“reports?date=“+dateText;
}
})
});

谢谢

在onSelect中尝试以下操作:

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

你现在看到了什么?未填充日期或日期格式错误?出现了什么错误?您提供的JavaScript不正确。没问题。请点击勾号图标,将此标记为已回答。如果它解决了问题,它会让我们感到高兴:)这与问题相比有什么区别?@WilliamNiu不确定你的意思…?我相信,
$.datepicker.formatDate(“yy mm dd”,“this.”.datepicker(“getDate”)==dateText
window.location.href="reports?date=" + $.datepicker.formatDate("yy-mm-dd", $(this).datepicker("getDate"));