user5563910
user5563910

Reputation:

Date Range Picker in 24 hour format

I am using the Date Range Picker plugin for bootstrap and I am trying to get the values in 24hour format. I have set the option timePicker24Hour: true but it still doesn't return it in 24 hour format.

This is my code:

$("#reportdatetime").daterangepicker({
    timePicker: true,
    timePicker24Hour: true,
    timePickerIncrement: 30,
    locale: {
        format: 'MM/DD/YYYY h:mm'
    }
});

Fiddle: https://jsfiddle.net/rdawkins/k67xfa1g/1/

Upvotes: 8

Views: 31570

Answers (3)

Arvind
Arvind

Reputation: 1016

Use the correct locale format.To display time in 24 hours format use the following -

$("#reportdatetime").daterangepicker({
    timePicker: true,
    timePicker24Hour: true,
    timePickerIncrement: 30,
    locale: {
        format: 'MM/DD/YYYY H:mm'
    }
});

working example : https://jsfiddle.net/Ly0jh5pz/2

Upvotes: 35

sssD
sssD

Reputation: 25

you can set AM/PM format into it if you want: here is some examples. Andhere is describing how to use moment formats.

Upvotes: 0

Hirendrasinh S. Rathod
Hirendrasinh S. Rathod

Reputation: 834

<script>
    $('#datepicker').daterangepicker({
        "timePicker": true,
        "timePicker24Hour": true,
        "startDate": "03/27/2016",
        "endDate": "04/02/2016"
        });
    });
</script>

Upvotes: 5

Related Questions