I have a system where the user can choose a period where after this period he earns for example + 2% of the sum he has chosen. If he tries to make an action with this sum before the half of the period it loses a percentage of its value. So what I want to know is how to calculate half of a date.
In my example:
I have for example in a mysql table the date when he put the sum and the date when the defined period will be finished.
So if it is 24-2-2022
and he chooses in 6 months, there will be two pieces of information in the database 24-2-2022
and 24-8-2022
.
What I’ve done so far is split()
the date to separate day, month and year. But here I am stuck because I do not know how to compare all this to see if the period is halfway or not.