We help IT Professionals succeed at work.

Using jQuery Date Picker I need more format options

curiouswebster
on
I need the following to format work:

M/D/YY
MM/D/YY
M/DD/YY
MM/D/YY
M/D/YYYY
MM/D/YYYY
M/DD/YYYY
MM/D/YYYY

Where do I insert these in here?

    $(function () {
        $("#datepicker").datepicker({
        });
    });


Thanks!
Comment
Watch Question

#
dateFormat

Type:
    String
Default:
    'mm/dd/yy'

The format for parsed and displayed dates. This attribute is one of the regionalisation attributes. For a full list of the possible formats see the formatDate function.
Code examples

Initialize a datepicker with the dateFormat option specified.

    $( ".selector" ).datepicker({ dateFormat: 'yy-mm-dd' });

Get or set the dateFormat option, after init.

    //getter
    var dateFormat = $( ".selector" ).datepicker( "option", "dateFormat" );
    //setter
    $( ".selector" ).datepicker( "option", "dateFormat", 'yy-mm-dd' );


But you would only use one at a time.
curiouswebsterSoftware Engineer

Author

Commented:
Thanks!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.