Click here to Skip to main content
15,886,075 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
here i have two dates , reference date and purchase date...

1. reference date shows in label.
2.purchase date has date picker

here i want to enable 15days, from reference date to purchase date,and other dates are disable.. piz help me..
ref date dont have datepicker..

here i used jquery

XML
<script type="text/javascript">
$(document).ready(function () {
//  var objDate = new Date("<%=Label1%>");
//var objDate = $("#Label1").val();
   //var objDate =  $('#<%=Label1.ClientID %>').val();

var objDate = $("#lbl_ref_date").val();
   var Presentyear = objDate.getFullYear();
        $("#txt_pur_date").datepicker({

      changeMonth: true,
      changeYear: true,
       dateFormat: "dd-mm-yy",
      maxDate: '+14d',
      minDate: '0d'
        });
        });
   </script>
Posted
Updated 20-Apr-15 0:05am
v2

Check this Demo:

http://jsfiddle.net/King_Fisher/rxnya8uk/[^]

Updated:

Quote:
min date(ref Date) should be any date not a current date.

JavaScript
minDate: -15
 
Share this answer
 
v2
Comments
sharat naik 20-Apr-15 7:00am    
min date(ref Date) should be any date not a current date... piz help me...
King Fisher 20-Apr-15 7:30am    
Any Date?
King Fisher 20-Apr-15 7:32am    
Solution Updated .
JavaScript
minDate: '0d'

0d here means the current date. So, according to your code, it will enable 15 days from today.

You need to assign the date you want to this minDate property in order to change this calculations.
 
Share this answer
 
Comments
sharat naik 20-Apr-15 7:02am    
min date(ref Date) should be any date not a current date... piz help me...
That is what I told you to replace the '0d' with the date you want.
sharat naik 20-Apr-15 7:16am    
i dont want 15 days from today... reference date may be any.. that reference date to 15 days .. i need new script or alter it for previous.. thank you
Hey, that is what exactly I am telling you. I think you are not getting me. I am just telling you to replace the code with the ref date, something like...

minDate: objDate
sharat naik 21-Apr-15 1:32am    
thank you so much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900