简体   繁体   中英

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"
        });

You're missing a comma at the end of:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM