I have a time string populated in select/list control e.g 05:40 I want to add 20 minutes in it and populate in textbox everytime when list value get changes in jquery or javascript
$(document).ready(function() {
$("#starttimeList").change(function() {
var selectVal = $('#starttimeList').val();
////// HERE I WANT MY CODE AS selectVal is getting value of select control e.g. 05:40 and entTime is my textbox where I want the time added with 20 minutes.
$("#endTime").val(selectVal);
});
});
If time is in the format hh:mm, you can use a simple function to convert it to minutes, add more minutes, then convert it back to hh:mm again:
The minutes to add can be a number or string.
If you need to allow for daylight saving, using a date object may make life easier.