php - Subtract 24 hour time string -


I would like to know whether string is possible to reduce the time of 24 hours?

  & lt ;? Php if ($ _ POST [startTime] - $ _POST [endtime] == 0) 'adjust your start time or time'; ? & Gt; & Lt; Div class = "form-group" & gt; & Lt; Label class = "col-lg-3 control-label" = "inputbide" & gt; End time & lt; / Label & gt; & Lt; Div class = "col-lg-9" & gt; & Lt; Select class = "form-control" id = "endTime" expected & gt; & Lt; Option value = "" & gt; Select end time & lt; / Option & gt; & Lt; Option value = "00:00" & gt; 12 mn & lt; / Options & gt; & Lt; Option value = "01:00" & gt; 1: 00am & lt; / Options & gt; & Lt; Option value = "02:00" & gt; 2: 00am & lt; / Options & gt; & Lt ;! - And so on .... - & gt; & Lt; Option value = "11:00" & gt; 11: 00am & lt; / Options & gt; & Lt; Option value = "12:00" & gt; 12: 00NN & lt; / Options & gt; & Lt; Option value = "13:00" & gt; 1: 00 pm  

This is the only way that I know how to take the user time. I have tried to use something ready to use the available classes on the internet, although I can not use the code twice (for one more initial time for the end). I tried to test the first code above, subtracting the wire, it always gives me zero I think the system only reduces the number of characters (though I'm not sure).

In addition, I tried to change every option value from "01:00" to "1" in normal number, it gives me a parse error: syntax error, unexpected 'die' . (I use to die in debugging, like price printing using dying) I even tried to remove the quote so that I think it will be converted to int. Gives me the same error

If you do not have to deal with partial hours, eg 03:45 and only full hours, then why not just send hours worth of prices to improve your form?

  & lt; Option value = "0" & ​​gt; 12:00 am & lt; Option value = "1" & gt; 1:00 o'clock ... & lt; Option value = "15" & gt; 3pm ...  

Then the subtraction becomes trivial.


Comments