0

Hi i using this code to show a expiration date based on the select.

<script>    
$(function(){                  
    $("#date_picker").datepicker();
    $("#Plano_Id").change(function() {
        var offset = +$(this).find("option:selected").attr("title"), /* get days to add on date*/
        theDate = new Date();
        theDate.setDate(theDate.getDate() + offset);         
        $("#date_picker").datepicker("setDate", theDate);
    });    
});        
</script>

But this returns the date in this format mm/dd/yyyy. I'm trying to show dd/mm/yyyy

4

2 に答える 2

4

For setting the format for a specific date control

$('#datepicker').datepicker({ dateFormat: 'dd/mm/yyyy' });

For setting it throughout your site/page, use

$.datepicker.setDefaults({ dateFormat: 'dd/mm/yyyy' });
//Note:Call this before initializing any date pickers
于 2012-08-28T17:20:26.673 に答える
1

Use the dateFormat option: http://jqueryui.com/demos/datepicker/#date-formats

于 2012-08-28T17:19:43.740 に答える