<legend id='ydL6U'><style id='ydL6U'><dir id='ydL6U'><q id='ydL6U'></q></dir></style></legend>

<small id='ydL6U'></small><noframes id='ydL6U'>

<i id='ydL6U'><tr id='ydL6U'><dt id='ydL6U'><q id='ydL6U'><span id='ydL6U'><b id='ydL6U'><form id='ydL6U'><ins id='ydL6U'></ins><ul id='ydL6U'></ul><sub id='ydL6U'></sub></form><legend id='ydL6U'></legend><bdo id='ydL6U'><pre id='ydL6U'><center id='ydL6U'></center></pre></bdo></b><th id='ydL6U'></th></span></q></dt></tr></i><div id='ydL6U'><tfoot id='ydL6U'></tfoot><dl id='ydL6U'><fieldset id='ydL6U'></fieldset></dl></div>

    <bdo id='ydL6U'></bdo><ul id='ydL6U'></ul>

      <tfoot id='ydL6U'></tfoot>

        在 jQuery UI 日期选择器中格式化日期

        时间:2023-09-05
        • <bdo id='j8qOf'></bdo><ul id='j8qOf'></ul>
          <legend id='j8qOf'><style id='j8qOf'><dir id='j8qOf'><q id='j8qOf'></q></dir></style></legend>
          <i id='j8qOf'><tr id='j8qOf'><dt id='j8qOf'><q id='j8qOf'><span id='j8qOf'><b id='j8qOf'><form id='j8qOf'><ins id='j8qOf'></ins><ul id='j8qOf'></ul><sub id='j8qOf'></sub></form><legend id='j8qOf'></legend><bdo id='j8qOf'><pre id='j8qOf'><center id='j8qOf'></center></pre></bdo></b><th id='j8qOf'></th></span></q></dt></tr></i><div id='j8qOf'><tfoot id='j8qOf'></tfoot><dl id='j8qOf'><fieldset id='j8qOf'></fieldset></dl></div>
          <tfoot id='j8qOf'></tfoot>
            <tbody id='j8qOf'></tbody>
              • <small id='j8qOf'></small><noframes id='j8qOf'>

                  本文介绍了在 jQuery UI 日期选择器中格式化日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我使用 jQuery UI 中的日期选择器,但格式类似于今天的示例:08/01/2013

                  但我希望今天的格式是示例:2013-08-01

                  这是我认为也许我应该使用的代码行?

                  `$("#txtFromDate").datepicker("option", "dateFormat", "yyyy-mm-dd");`

                  这是我使用的 jQuery 代码,它工作正常,但不知道该放在哪里?我想要我的两个领域的格式.

                  <前>`$(文档).ready(函数(){$("#txtFromDate").datepicker({minDate: "07/17/2012",最大日期:0D",numberOfMonths:2,onSelect:函数(选定){$("#txtToDate").datepicker("option","minDate", selected);}});$("#txtToDate").datepicker({minDate: "07/17/2013",最大日期:0D",numberOfMonths:2,onSelect:函数(选定){$("#txtFromDate").datepicker("option","maxDate", selected);}});});`

                  我希望有人对此有解决方案:-)

                  解决方案

                  因为你在 datepicker 中已经有其他选项了...把它添加到那里.

                  试试这个

                  $("#txtFromDate").datepicker({minDate: "07/17/2012",最大日期:0D",numberOfMonths:2,dateFormat: "yy-mm-dd",//<----这里onSelect:函数(选定){$("#txtToDate").datepicker("option","minDate", selected);}});

                  I use the datepicker from jQuery UI, but the format is like example today: 08/01/2013

                  But i want the format to be example today: 2013-08-01

                  Here is code line i think maybe i should use?

                  `$( "#txtFromDate" ).datepicker( "option", "dateFormat", "yyyy-mm-dd" );`

                  And here is my jQuery code i use that works fine but don't know where to put the line? And i want the format in both of my fields.

                  `
                  $(document).ready(function(){
                      $("#txtFromDate").datepicker({
                          minDate: "07/17/2012",
                          maxDate: "0D",
                          numberOfMonths: 2,
                          onSelect: function(selected) {
                            $("#txtToDate").datepicker("option","minDate", selected);
                          }
                      });
                      $("#txtToDate").datepicker({ 
                          minDate: "07/17/2013",
                          maxDate:"0D",
                          numberOfMonths: 2,
                          onSelect: function(selected) {
                             $("#txtFromDate").datepicker("option","maxDate", selected);
                          }
                      });  
                  });`
                  

                  I hope somebody have a solution for this :-)

                  解决方案

                  since your already have other options in the datepicker... add it there.

                  try this

                  $("#txtFromDate").datepicker({
                      minDate: "07/17/2012",
                      maxDate: "0D",
                      numberOfMonths: 2,
                      dateFormat: "yy-mm-dd", //<----here
                      onSelect: function(selected) {
                        $("#txtToDate").datepicker("option","minDate", selected);
                      }
                  });
                  

                  这篇关于在 jQuery UI 日期选择器中格式化日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:JavaScript Number.toLocaleString() 分隔符后有 4 位数字 下一篇:使用 CSS 将数字格式化为货币

                  相关文章

                  最新文章

                1. <legend id='TckXZ'><style id='TckXZ'><dir id='TckXZ'><q id='TckXZ'></q></dir></style></legend><tfoot id='TckXZ'></tfoot>

                      <bdo id='TckXZ'></bdo><ul id='TckXZ'></ul>
                    1. <small id='TckXZ'></small><noframes id='TckXZ'>

                    2. <i id='TckXZ'><tr id='TckXZ'><dt id='TckXZ'><q id='TckXZ'><span id='TckXZ'><b id='TckXZ'><form id='TckXZ'><ins id='TckXZ'></ins><ul id='TckXZ'></ul><sub id='TckXZ'></sub></form><legend id='TckXZ'></legend><bdo id='TckXZ'><pre id='TckXZ'><center id='TckXZ'></center></pre></bdo></b><th id='TckXZ'></th></span></q></dt></tr></i><div id='TckXZ'><tfoot id='TckXZ'></tfoot><dl id='TckXZ'><fieldset id='TckXZ'></fieldset></dl></div>