16
How to know if an informed day, of the current month, fell on the weekend? For example:
echo isWeekend(24) // True
echo isWeekend(26) // False
In the related topic below, I can know today through the method date
:
date('w')
But there is no function in the method date
to something like what I want.
I want to get a list of the total days of the month with cal_days_in_month
and check day by day, if it is a weekend, receive differentiated treatment.
Related: How to know if today’s date is Saturday or Sunday (weekend) in PHP?
Knowing only the day can not tell if it fell on the weekend, there is something missing there.
– rray
I added, it could be the current month. @rray
– Marcelo de Andrade
@Bacco, I want to get a list of the total days of the month,
cal_days_in_month
and check day by day, if it is a weekend, receive differentiated treatment.– Marcelo de Andrade
I replied giving a general idea, just apply the mktime in your loop. But when you do, put the whole problem to the question, because there may be better ways to do it. Always do your posts in the most complete way possible. This helps us help you. The answers are made on top of what is asked.
– Bacco
Relevant: http://answall.com/q/70473/132 - Take a look at my answer, as one of the things it addresses is the determination of the day of the week.
– Victor Stafusa
@Bacco was my distraction, I supplemented the question with the comment.
– Marcelo de Andrade