Something like the example below I plan to do, just like Google Maps.
Something like the example below I plan to do, just like Google Maps.
You can implement this functionality as follows:
For the structure of your database table, you can create something like this:
[ID - COD_EMRPESA - DIA_SEMANA - HORA_ABERTURA - HORA_FECHAMENTO]
So, the example company in question would have 11 records in the database: 2 for each day Monday through Friday and 1 for Saturday.
I do not think it's necessary to determine the period. What would be the period of a company that stays open from 09:00 to 18:00 for example?
Based on the documentation for the date () function ( link ), you would store the information for each company in the database as follows:
First, to get the current day of the week write:
$dia_da_semana = date('N')
And to get the current hour and minute:
$horario = date('H:i')
So, just compare the strings returned above with the values in the database to determine if the company is open or not.