I'm making a calendar but I ran into a problem. I have been trying to find out how to get the first day of a month. I used to do it like this:
$start = date('d', strtotime("$year-$month-1")); // For this month '2015-9' it returns 1
Now I know I need to add 1 empty element in the calendar to start at the correct day.
But now I would like to do this with the DateTime class but I have no idea of how to do this. I would like to know if something similar to the above code is doable with the DateTime class.
Update
Lets asume That my calendar is below.
|S|M|T|W|T|F|S|
|0|1|2|3|4|5|6|
Each month starts on a different day and I would like to know this days number.