Reputation: 62
$(document).ready(function () {
$("#<%=txtDate.ClientID %>").datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true
}).datepicker("setDate", "0"); });
It shows Current Date (16-02-2016). But I need to Set 2016 as 2017.
How to Set the Year?
Upvotes: 3
Views: 5771
Reputation: 692
$(document).ready(function () {
var today=new Date();
$("#<%=txtDate.ClientID %>").datepicker({
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true
}).datepicker("setDate", new Date(today.getFullYear()+1, today.getMonth(), today.getDate())); });
Upvotes: 2