Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // PHP: date functions' results related to the NEXT month are not correct
- // http://stackoverflow.com/questions/10834350/php-date-functions-results-related-to-the-next-month-are-not-correct-php-bugs
- // RESULTS (OUTPUT) of http://pastebin.com/3iaH4iSZ
- // @see http://i.stack.imgur.com/mHHRu.png
- strtotime('today');:
- 1338415200
- strtotime('next month');:
- 1341147559
- Current date as a MySQL-compatible timestamp [ date('Y-m-d H:i:s'); ]:
- '2012-05-31 14:59:19'
- Get next month as a timestamp [ date('Y-m-d H:i:s', strtotime('next month')); ]:
- '2012-07-01 14:59:19'
- Get last day of the next month as a timestamp with DateTime class [ $dateObj->add(new DateInterval('P1M')); $dateObj->format('Y-m-d H:i:s'); ]:
- '2012-07-01 14:59:19'
- Get last day of the current month/Get number of days in the current month [ date('t', strtotime('today')); ]:
- '31'
- Get last day of the next month/Get number of days in the next month [ date('t', strtotime('next month')); ]:
- '31'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement