Reputation: 2787
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'
});
current output is
05/31/2013 00:12
required output is
00:12
Upvotes: 18
Views: 96305
Reputation: 119
None of these solutions worked for me. After some playing around I saw the following worked. What I was looking for was to put a time (in hours:minutes) in a form.
<script>
$(function() {
$("#from").datetimepicker({
dateFormat: '',
datepicker:false,
pickDate: false,
format: "H:i",
timeOnly:true
});
$("#end").datetimepicker({
dateFormat: '',
datepicker:false,
pickDate: false,
format: "H:i",
timeOnly:true
});
});
</script>
When I now view my form I get the following:
Upvotes: 1
Reputation: 11
Try this, works like a charm !
$('.time_only').datetimepicker({
pickDate : false ,
format: 'hh:mm'
});
Upvotes: 0
Reputation: 1
$(function () {
$('#datetimepicker').datetimepicker({
format:'H:i:s',
inline: true,
sideBySide: true
})
});
try this .worked for me
Upvotes: 0
Reputation: 191
try a code like this:
<script>
$('#time_input').datetimepicker({
datepicker:false,
format:'H:i'
});
</script>
Upvotes: 11
Reputation: 358
Just adding a simple solution. By adding only this , you can get a time only date picker
$('YOUR_SELECTOR').datetimepicker({
format: "HH:mm"
});
Simple solution, hope it helps.
Upvotes: 5
Reputation: 20590
Just set dateFormat to an empty string dateFormat: ''
$('#field-start_t_a').datetimepicker({
dateFormat: '',
timeFormat: 'hh:mm tt'
});
(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)
Upvotes: 21
Reputation: 101
$('.picker').datetimepicker({
dateFormat: '',
timeFormat: 'hh:mm tt',
**timeOnly: true**
});
Upvotes: 8
Reputation: 1964
<script type="text/javascript">
$("#time_field_id").datetimepicker({
dateFormat: '',
timeFormat: 'hh:mm tt',
timeOnly: true
});
</script>
Upvotes: 1