2

我正在使用来自tarruda的 bootstrap-datetimepicker并且我已经看过这个文档但是当我尝试用它格式化它DD/mm/yyyy不起作用时,它给了我DD/02/2013. 我希望它像Mon Dec 02 2013. 有什么帮助吗?
这是我的代码:

       <div class='input-append date' id='datetimepicker1'>
         <input name="bdate" date-format='DD/mm/yyyy' type='text' placeholder="Date"/>
         <span class='add-on'>
           <i data-date-icon='icon-calendar' data-time-icon='icon-time'>
              </i>
          </span>
        </div>
            <script type="text/javascript">
              $(function() {

                $('#datetimepicker1').datetimepicker({
                  pickTime:false,
                  format: 'DD/mm/yyyy'
                });                                             
              });

            </script>  
4

2 回答 2

0

Bootsrap datetimepicker 使用 MomentJS,这里是Moment JS Doc的链接

这是正确的代码。

$('#datetimepicker1').datetimepicker({
     pickTime: false,
     format: 'ddd MMM DD YY'
});
于 2016-08-23T23:46:27.330 回答
-3

bootstrap 没有 datetimepicker。这是 jquery UI 小部件!看这个http://api.jqueryui.com/datepicker/ 你格式不对,试试

            $('#datetimepicker1').datetimepicker({
              pickTime:false,
              format: 'dd/mm/yy'
            });

格式可以是以下组合:

d - day of month (no leading zero)
dd - day of month (two digit)
o - day of the year (no leading zeros)
oo - day of the year (three digit)
D - day name short
DD - day name long
m - month of year (no leading zero)
mm - month of year (two digit)
M - month name short
MM - month name long
y - year (two digit)
yy - year (four digit)
@ - Unix timestamp (ms since 01/01/1970)
! - Windows ticks (100ns since 01/01/0001)
'...' - literal text
'' - single quote
anything else - literal text
于 2013-11-14T11:27:30.347 回答