I have a 24 hour time string (ie 16:30) and would like to add x time blocks of 30 mins. For example if x = 4, then 16:30 + 4(30) = 18:30. Is there any easy way to do this with out exploding the string and doing if statements for mins/hours.. etc? Also this is on a php page would it be easier to do this in php then echo it to the javascript?
Thanks for the help!
You could add to a timestamp and then format it to HH:MM
You’ll want to pad zero’s to the hours and minutes.
You can do it in PHP pretty much the same way:
The new time will already be formatted with leading zero’s.