I'd like to know if it is possible to subtract a string 24 hour time?
<?php if($_POST[startTime] - $_POST[endTime] == 0) echo 'PLEASE ADJUST YOUR START TIME OR END TIME'; ?> <div class="form-group"> <label class="col-lg-3 control-label" for="inputBday">End Time </label> <div class="col-lg-9"> <select class="form-control" id="endTime" required> <option value="">Select End Time</option> <option value="00:00">12 MN</option> <option value="01:00">1:00 AM</option> <option value="02:00">2:00 AM</option> <!-- and so on .... --> <option value="11:00">11:00 AM</option> <option value="12:00">12:00 NN</option> <option value="13:00">1:00 PM</option> <option value="14:00">2:00 PM</option> <!-- and so on ... --> <option value="22:00">10:00 PM</option> <option value="23:00">11:00 PM</option> </select> </div> </div> That's the only way I know how to let the user pick time. I have tried using a certain ready to use classes available on the internet, however I can't use the code twice (one for end and one for start time). I tried testing the first code above, subtracting the strings, it always returns me zero. I think the system just subtracts the number of characters. (i'm not sure though).
Also, I tried changing each option value to normal numbers like from "01:00" to "1", it returns me Parse error: syntax error, unexpected 'die'. (I use die in debugging, like printing the value using die). I even tried removing the quotes so that I think it will be converted to int. Returns me the same error.