开发者

Jquery Datetime picker Date format Issue

开发者 https://www.devze.com 2023-01-19 08:36 出处:网络
I am using jquery datetime picker. it is showing date in \"yy/MMM/dd 开发者_如何学Gohh:mm:ss\" format on selecting the date and time. i am not able to change its format. How can i change it to my cust

I am using jquery datetime picker. it is showing date in "yy/MMM/dd 开发者_如何学Gohh:mm:ss" format on selecting the date and time. i am not able to change its format. How can i change it to my custom format "dd/MM/yyyy hh:mm"


You can set it at initialization like this:

$([selector]).datepicker({
    dateFormat: "dd/MM/yyy hh:mm"
});

Or you can set the date format after initialization using the following code:

$( ".selector" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );


After initializing the datepicker

$('#selector').datepicker();

you could do

$('#selector').datepicker('option', 'dateFormat', 'dd-mm-y');

See THIS for possible formats


$(function(){
    var pickerOpts = {
        dateFormat:"d MM yy"
    };  
    $("#date").datepicker(pickerOpts);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号