Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change date format in date time picker?

I found a great date time picker based on jQuery-ui http://trentrichardson.com/examples/timepicker/, but suddenly realized that i can't modify date format... Tried something like this:

jQuery('.datetimepicker').datetimepicker({
        timeFormat: 'HH:mm'
    }).formatDate('yy-mm-dd');

Can someone show an example on it?

like image 392
Kin Avatar asked Jan 23 '13 08:01

Kin


3 Answers

You can use the code:

jQuery('.datetimepicker')
    .datetimepicker({ 
        dateFormat: 'yy-mm-dd', 
        timeFormat: 'HH:mm' 
     });
like image 83
Tim B James Avatar answered Nov 04 '22 11:11

Tim B James


Try this:

This will set the date format to "yy-mm-dd"

 $.datepicker._defaults.dateFormat = "yy-mm-dd";
like image 27
Anton Avatar answered Nov 04 '22 11:11

Anton


Yes it is possible, have a look at the dateFormat option in the API Documentation for the datepicker

This will work,

jQuery('.datetimepicker').datetimepicker({
        timeFormat: 'HH:mm',
        dateFormat: "yy-mm-dd"
});
like image 34
painotpi Avatar answered Nov 04 '22 11:11

painotpi