Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set am/pm format in jquery using datetimepicker

Tags:

jquery

this is my jquery code.eventdatpicker is display date only,but occasionStartTime and occasionEndTime it display 24 hours format only how to change this format to am/pm format?

$(function() {
    $('#occasionStartTime').datetimepicker({
        datepicker : false,
        format : 'H:i'
    });
    $('#occasionEndTime').datetimepicker({
        datepicker : false,
        format : 'H:i'

    });
    $('#eventDatePicker').datetimepicker({
        timepicker : false,
        format : 'd.m.Y'
    });
});
like image 404
nmkkannan Avatar asked Apr 03 '14 20:04

nmkkannan


1 Answers

$('#StartDate').datetimepicker(
                {
                    format: 'DD MMM YYYY hh:mm A'

                });

where startDate is a divId

    <div class="input-group date form_datetime" id="StartDate">
         <input type="text" class="form-control input-lg" placeholder="From" name="StartDate" id="txtStartDate" required /> 
<span class="input-group-addon">
<span class="glyphicon-calendar glyphicon"></span></span>
 </div>

This will give you format like: 25 Mar 2016 01:08 PM

like image 195
Chirag Gardhariya Avatar answered Sep 21 '22 09:09

Chirag Gardhariya