Dates showing up wrong on 31st of the month. |
In your original posted function you are sending something like '-1 months' and setting the variables:
PHP Code: $pm = (int) date('n', strtotime($month_num)); Where 'n' is 1-12 and 'Y' is full year like 2017. So just change it to (and I am not sure if you mean by -1 months to include last month or just to cover the current month) PHP Code: $date = new DateTime('FIRST DAY OF '.$month_num); Nothing will have changed apart from your dates should all work now. PS have not tested this just wrote it out so might be a bit buggy. In theory it is right. Edit: Just tested it on phpfiddle and it is working fine, but can't remember my login so can't post a link :-) Just paste this in and you will see it: http://phpfiddle.org/ PHP Code: <?php |
Messages In This Thread |
Dates showing up wrong on 31st of the month. - by doomie22 - 05-31-2017, 03:51 AM
RE: Dates showing up wrong on 31st of the month. - by php_rocs - 05-31-2017, 08:18 PM
RE: Dates showing up wrong on 31st of the month. - by PaulD - 06-01-2017, 10:34 AM
RE: Dates showing up wrong on 31st of the month. - by doomie22 - 06-01-2017, 01:08 PM
RE: Dates showing up wrong on 31st of the month. - by PaulD - 06-01-2017, 03:47 PM
|