0
I’ll have a system that will have a term of days Ex: 30 days.
I need to calculate a given date within a given deadline, which in case it is a weekend is interpreted as the last working day within the deadline.
Example:
Today: 09-12-2014, Term: 11 days
Should fall in the day 20-12-2014(Saturday), however the system should identify and reduce the deadline to 10 days and inform the final date for the deadline that will be 19-12-2014.
It’s not the full answer but it’s a course to follow :
echo date('d/m/Y', strtotime('+5 days', strtotime('14-07-2014')));
sum 5 days from the date of '14-07-2014' to do from todayecho date('d/m/Y', strtotime('+5 days'));
– Antony Alkmim
For example: $data = today; I have to check if ($date minus 1 day) is Saturday/Sunday or I have to check if $date is Saturday/Sunday?
– Antony Alkmim
If the final date is Saturday or Sunday I have to make it "give as deadline" the Friday to be working day.
– phpricardo
Do you then need that given a period of for example 30 days, counting from today, to inform the final date, given that if the final day is a Saturday or Sunday, it is changed to Friday? I couldn’t understand what you needed.
– Antony Alkmim
I’m seeing something like this: $days = 30; // Input Ex $dataFinal = date('Y-m-d', strtotime("+" . $days . "day", strtotime("now"))); // Here I’ll get the final date + 30 with this I think we can start. Because I will enter in the database the date of Today and also this final Tada and then I make a diff of SQL to try to show the user time of days left. The question now is weekend.
– phpricardo
About weekend we will see example: Being today’s date 09/12/2014 and more 11 days will fall on 20/12/2014 ie Saturday! With this so I tell the user that the day limit for him to solve THAT, will be day 19/12/2014 by Saturday will not be working day. Check it out? : D
– phpricardo
Let’s go continue this discussion in chat.
– Antony Alkmim