Re: How to store opening time of shops?

From: The Natural Philosopher <tnp_at_invalid.invalid>
Date: Mon, 18 Mar 2019 11:18:54 +0000
Message-ID: <q6nuqu$qki$1_at_dont-email.me>


On 17/03/2019 11:39, ^Bart wrote:
> I should store opening time of shops but I think I can't use just one
> field!
>
> There are shops opened every days from 08:00 am to 08:00 pm others
> opened just few days and not with the same time every days... :\
>
> How could I solve this problem?
>

First you need to clearly define this problem.

[Quoted] It is possible for a shop to open and close many different times on one day and many different days so it terms of reducing it, it make be that there is no general solution that can be applied.

[Quoted] The most generaic solutin to such a thing is to use your shop ID as a key, and have a table of ALL its possible opening times pointing to that key, so one shop->many opening times.

[Quoted] In order to see which one applies, you may need to have a compex 'opening times' table, to accomodate the fact that on the 27th July 2019 the shop will be losed betwee 3pm and 6pm (for a funeral)

[Quoted] So you would then need an algorithm tha, for a given day, looks to see if there is a particulatr entry and if not, if there is a generic entry for the month date, date, day of week and so on.

And give them precedence.

[Quoted] Or perhaps stire thge general case in the store table and then store the exceptions elsewhere.

> Regards.
> ^Bart

-- 
If you tell a lie big enough and keep repeating it, people will 
eventually come to believe it. The lie can be maintained only for such 
time as the State can shield the people from the political, economic 
and/or military consequences of the lie. It thus becomes vitally 
important for the State to use all of its powers to repress dissent, for 
the truth is the mortal enemy of the lie, and thus by extension, the 
truth is the greatest enemy of the State.

Joseph Goebbels
Received on Mon Mar 18 2019 - 12:18:54 CET

Original text of this message