Once a user has selected their start time, I then need to calculate a start time for us which is say 75 minutes before the time they selected, and a finish time for us which is say 85 minutes after their selected time using javascript. It does need to be in minutes only.
So the user field is a timepicker only field displaying only time as HH:MM
<input type="text" id="time" name="time" /> //User input from timepicker
<input type="text" id="start_time" name="start_time" />// Start time for us 75 minutes before
<input type="text" id="start_time" name="start_time" />//End time for us 85 minutes after
Please can anyone help?
I have tried various things I have found, but what I am searching for is something like this which calculates the day of the week and enters it in a second field for submition:
<input type="text" id="date" name="date" readonly="readonly" onChange="showDate(this.value)" />
function showDate(getdate) {
var selectedDate = new Date(getdate);
var dateformat = getdate.split('-')
var displaydate = document.getElementById('day')
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
if (displaydate) {
document.getElementById('day').value=days[selectedDate.getDay()];
}
}
If I could have a script like this which adds or subtracts minutes from timepicker input field and puts it in a second input as HH:MM, that would be perfect!
So for example, if the user selected 07:30 in the timepicker, the script takes this time from this field and deducts 75 minutes (MUST BE IN MINUTES) to make a time of 06:15 in another input field, and same for adding minutes as well in another field.