Skip to content
Advertisement

How to find current day no. in month in php

Today’s date is 27-01-2014 so I got day name using following function:

JavaScript

So now the day name is mon.

How to find that this Monday is the forth Monday of current month? In other words, I am trying to find the 1st, 2nd, 3rd, 4th of a particular day (eg. Monday) of a month?

Advertisement

Answer

Credit for the Math part goes to Jon (above)

In combination with your code, full solution can be implemented as follows

JavaScript

or else as a function with optional date

PHP Fiddle here

This just return the number you are requesting.

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