I am using the following code to display the date in a form.
In the form I have a field titled "Duration" being weekly rental eg 3 weeks, 5 weeks etc..
I would like the "Return Date" do display the date "X" number of weeks from the date the form is filled out, what ever "Duration" was selected.
How can I (+ 7) the Date but instead of (+ 7) do a (+ Duration)?
ALSO I don't know how to return this "Date" to my Excel spread sheet (Google Sheets) All the other fields work fine but I don't know what I am missing or how to return the inline JavaScript result to the excel/google sheets.
<span id="time" name="time" class="form-control" readonly>
<script type="text/javascript">
var d=new Date();
d.setDate(d.getDate() + 7);
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday",
"Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",
"Sep","Oct","Nov","Dec")
document.write(weekday[d.getDay()] + " ")
document.write(d.getDate() + " ")
document.write(monthname[d.getMonth()] + " ")
document.write(d.getFullYear() + " ")
</script>
</span>
____________________________________________________________________________
If you need the whole code I would be happy to share it but have only included the string which I am trying to reflect the current date + Duration in a readonly form field.
Thanks in advance if I don't reply soon. Jeff
You can get the next date with duration with this suppose
and
then the next date
you can format the date aas string like this
You can bind the event listner, by which input you are using for duration selection and there you can set this date to value of your readonly input