2013-11-14 70 views
2

我使用的是從tarruda自舉的DateTimePicker,我已經看到了這個documentation但是,當我試圖格式化與DD/mm/yyyy它不工作,它給了我DD/02/2013。我希望它像Mon Dec 02 2013。任何幫助?
這裏是我的代碼:自舉的DateTimePicker格式不起作用

 <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> 

回答

-3

引導沒有一個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 
+0

您確實訪問過我提供的鏈接嗎? – leonardeveloper

0

Bootsrap的DateTimePicker使用MomentJS這裏是鏈接到Moment JS Doc

以下是正確的代碼。

$('#datetimepicker1').datetimepicker({ 
    pickTime: false, 
    format: 'ddd MMM DD YY' 
});