Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8947513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:46:47+00:00 2026-06-15T12:46:47+00:00

Got the datePicker working to select multiple dates. When the user selects multiple dates

  • 0

Got the datePicker working to select multiple dates. When the user selects multiple dates and closes the calendar the textbox displays the dates in the format:

Thur Jan 03 2013 00:00:00 GMT +0000
Fri Jan 03 2013 00:00:00 GMT +0000
Sat Jan 04 2013 00:00:00 GMT +0000,

My Code:

<script>

            $("#HolidayDate").addClass('date-pick');
            $('.date-pick').datePicker//({dateFormat: 'dd-mm-yy'}).val();
            (
                    {
                        createButton: false,
                        displayClose: true,
                        closeOnSelect: false,
                        selectMultiple: true,                  
                    }
            )
            .bind(
                'click',
                function () {
                    $(this).dpDisplay();
                    this.blur();
                    return false;
                }
            )
            .bind(
                'dateSelected',
                function (e, selectedDate, $td, state) {
                    console.log('You ' + (state ? '' : 'un') // wrap
                        + 'selected ' + selectedDate);
                }
            )
            .bind(
                'dpClosed',
                function (e, selectedDates) {
                    console.log('You closed the date picker and the ' // wrap
                        + 'currently selected dates are:');
                    console.log(selectedDates);
                    $('#HolidayDate').val( selectedDates );
                }
            );

    </script>

However I would like the date to display as dd-mm-yy.
If I use the commented out line

$('.date-pick').datePicker//({dateFormat: 'dd-mm-yy'}).val();

and run it as    $('.date-pick').datePicker({dateFormat: 'dd-mm-yy'}).val();

The textbox will return the date in the correct format but now it only allows me to select one date at a time.

Please advice?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:46:49+00:00Added an answer on June 15, 2026 at 12:46 pm

    Its because you left ouy the options saying it is a selectmultiple.

    try

    $('.date-pick').datePicker
                (
                        {
                            createButton: false,
                            displayClose: true,
                            closeOnSelect: false,
                            selectMultiple: true,   
                            dateFormat: 'dd-mm-yy'               
                        }
                )
    

    See that i added it to the previous options you had?

    Edit

    After reading kelvinlucks documentation on this, I see what’s causing your problem. The date you get in return is a javascript Date object and not a string. You are free to format it as you wish, but in your overloaded methods dateSelected and dpClosed they are just printed without formatting.

    Try this:

    .bind(
        'dateSelected',
        function(e, selectedDate, $td, state)
        {
            var date = selectedDate.getDate() + "-" + (selectedDate.getMonth() + 1) + "-" +     selectedDate.getFullYear();
            console.log('You ' + (state ? '' : 'un') // wrap
                + 'selected ' + date);
    
        }
    )
    

    My formatting of dates isn’t so good, but you get the point. Here’s a post on formatting dates (http://stackoverflow.com/questions/1056728/formatting-a-date-in-javascript)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a weeknumber from a jquery datepicker, when a user selects a date.
So I've got a control that has all different user inputs (comboBox, textBox, DatePicker,
Got the jQuery UI datepicker plugin working wonderfully, however, when using IE7, the calendar
I've got this answer working but I'd like to extend it: jQuery UI Datepicker
I got a calendar which I want to take birthday of user. Its id
I'm using the jQuery DatePicker control for the first time. I've got it working
I got 2 DateTime field and i use datepicker for user to choose a
I placed a datepicker on a layout to let the user select their birthday.
I've got an application that uses jQuery UI DatePicker on an ASP.NET textbox control.
I've got an ASP user control which is basically using jquery UI datepicker just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.