I am stuck with the automatic calculation of days and automatic insertion of month, calendar week based on the user entered data.
I searched and I got to calculate the differences only by static not by the user entered dates.
I have 6 Text boxes.
- 1st textbox "Year" user enters a specific date (dd.mm.yy)
- 2nd text box needs to be automatically filled with the respective calendar week
- 3rd text box needs to be automatically filled with the respective month (Jan, Feb, Mar)
4th text box needs to be automatically filled with the respective year
5th text box user enters another date (dd.mm.yy)
- 6th text box needs to be automatically filled with the number of days difference between 2nd entered date and first entered date.
My code is as below.
$(function() {
$( "#datepicker").datepicker({ dateFormat: 'dd.mm.yy' });
$("#datepickerend").datepicker({ dateFormat: 'dd.mm.yy'});
});
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div>
<table border="0">
<tr>
<td>Date: <input type=text name="date" id="datepicker"></td>
</tr>
<tr>
<td>CW: <input type=text name="CW"></td>
</tr>
<tr>
<td>Month: <input type=text name="Month"></td>
</tr>
<tr>
<td>Year: <input type=text name="Year"></td>
</tr>
<tr>
<td>Ending Date: <input type=text name="enddate" id="datepickerend"></td>
</tr>
<tr>
<td>Days: <input type=text name="days"></td>
</tr>
</table>
</div>