User7291
User7291

Reputation: 1115

format date for jquery ui datepicker

i'm trying the following code but it keeps giving me syntax errror under dateformat... how can i fix this? i just need to change the format of the date

   var date = new Date();
        var currentMonth = date.getMonth();
        var currentDate = date.getDate();
        var currentYear = date.getFullYear();
        $('#datepicker1').datepicker({
            minDate: new Date(currentYear, currentMonth, currentDate)
             dateFormat:"yyyymmdd"
        });

Upvotes: 0

Views: 53

Answers (2)

vani saladhagu
vani saladhagu

Reputation: 184

use date.js to get today, yesterday and tomorrow etc dates. it is more flexible to add dates.http://www.datejs.com/

Upvotes: 0

j08691
j08691

Reputation: 207861

You're missing a comma at the end of:

minDate: new Date(currentYear, currentMonth, currentDate),
                                                         ^ missing

Upvotes: 2

Related Questions