Skip to content
Advertisement

How can getdate[“weekday”] start from Monday instead of sunday?

I need to start the “weekday” of getdate() to Monday instead of Sunday, is there a way to do this?

Here is my code, don’t worry about the parameters in validatePlanningVendeur the problem is when i try to get the current date arret, so that it can validate from Monday till arret.

You might notice i wrote $arret = $today["wday"]-1;,this is my attempt to bypass the wkday Sunday = 0 so that Monday is 0, but now it does not work for Sunday because it is equal to -1.

To get it short, right now $arret work from Monday to Saturday only.

JavaScript

Advertisement

Answer

Try to use this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement