php - how to determine if selected date and time is within the range of the duration -
How to check the date and time of my chosen date (this is the minute)?
This is my code:
function check-time () {$ time = $ this- & gt; Input-> Post ("time" is true); $ This- & gt; Db- & gt; Select ("time, duration"); $ This- & gt; Db- & gt; ("Timetable"); $ Query = $ this- & gt; Db- & gt; get receive (); $ Message = array (); $ Time converted = stratetime ($ time); Foreach ($ query- & gt; result () as the $ line) {if ($ timeConverted == $ row- & gt; time) {$ message = array ("message" => Please enter another date Select more time "); } Other {$ message = array ("message" => "available"); }} $ This-> Output-> Set_output (json_encode ($ message)); }
In that argument, I'm just checking whether the selected time and date is equal to the values in my database. I want to add a period thank you in advance.
I believe you are looking for something like this:
< Code> if $ time converted & gt; = $ Row-> Time & amp; Amp; $ Time Converted & lt; = $ Row-> Time + $ line-> Duration
Comments
Post a Comment