How to store office hours in PostgreSQL rows, so that I can calculate the office hours.
Example:
* We have open from 9:00 to 18:00 from Monday till Friday.
* Saturday we have open from 10:00 to 15:00
* from 24. Dec to 31. Dec we have open from 10:00 to 13:00 (but not on Saturday and Sunday)
* bank holidays like 25/26 December are closed.
* All above rules are valid until 31. Dec 2021.
* Starting from 01. January 2022 we have open from 10:00 to 18:00 from Monday till Friday. Saturday is open like before.
I would like to store this data in rows, so that we can develop an interface for it.
And then there needs to be a method which uses the rows/rules to calculate the specific opening hours.
Different timezone are not important in this context.
I use PostgreSQL version 12.6. But if needed I can upgrade to a newer version.
Asked by guettli
(1591 rep)
May 3, 2021, 07:30 PM
Last activity: May 4, 2021, 09:54 PM
Last activity: May 4, 2021, 09:54 PM