如何只显示时间在jQuery datepicker?

问题描述:

我只想显示来自jquery datepicker的时间. 我当前的代码是

I want to display only time from jquery datepicker. my current code is

$('#field-start_t_a').datetimepicker({
  showDate:false, 
   showSecond: true,

   timeFormat: 'hh:mm'
});

当前输出为

05/31/2013 00:12

必需的输出是

00:12

只需将dateFormat设置为空字符串dateFormat: ''

Just set dateFormat to an empty string dateFormat: ''

$('#field-start_t_a').datetimepicker({
    dateFormat: '',
    timeFormat: 'hh:mm tt'
});

(这有点奇怪,您只想从datetimepicker设置时间,因为您也可以执行$('#field-start_t_a').timepicker();并且只显示时间选项)

(this is a little strange that you only want to set time from the datetimepicker, because you can also do $('#field-start_t_a').timepicker(); and only the time options show)