P
P
Pavel2019-03-22 12:30:24
PHP
Pavel, 2019-03-22 12:30:24

How to arrange the logic of adding data to the database with checking for weekends and holidays?

I am making a time sheet, it is necessary to count the number of hours of "processing" that are paid at a different rate. This tariff is x2 on weekends and holidays in the database, you need to do 2 columns, working hours and processing hours.
And for convenience, enter data in one field on the frontend in the form, then if the date of adding to the database == day off, then write all the data in the processing column. Also for the holiday
. If it's not a day off, but more than 8 hours are worked, then write 8 in the hours and the rest in the processing database.
before that, everything seems to be simple, but now if the day off means a shortened day, then we write 7 hours to work and the rest to processing
and the most important question: how to find out that the date, for example 2019-03-22, is a day off or a holiday?Means it is necessary to do the separate table with these dates for comparison? I do not understand the principle to the end, who will tell you the logic of how to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anatoly, 2019-03-22
@mrusklon

Well, you can find out the day off by the day of the week, but the holidays will have to be stored somewhere in the database, or look for a ready-made API on this topic, or find the API of some service where you can pull out the holidays.
Here and there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question