Zakman411
Zakman411

Reputation: 1764

Jquery UI Date Picker: Implementing Alternate Format

I'm trying to have my Jquery UI Date Picker insert YYYY/MM/DD format (due to SQL limitations). I see the options on the Jquery site, but can't get it to work. Below is my working code (without Alt Date). It's in a div that is hidden initially so it needs live():

$(function() { 
    $('.datepicker').live('focus', function () {
        var picker = $(this).datepicker({showOn: ''});
        picker.datepicker("show");

    });
});

Any help?

Upvotes: 2

Views: 961

Answers (1)

JJ.
JJ.

Reputation: 5475

You need to add "option", "dateFormat", "yy/mm/dd" to your datepicker call.

    var picker = $(this).datepicker({dateFormat: "yy/mm/dd", showOn: ''});

This will make datepicker format the date value selected as 2011/08/22.

Upvotes: 2

Related Questions