![]() ![]() ![]() The parameters passed in the format() function is - Y, m and t. This is the best method to use to get the last date of a month both with future and past dates. ![]() PHPĭateTime to Get the Last Date of the Month Note the key to getting the last day of the month is the letter t which returns the number of days in a given month. However, strtotime is awesome for converting dates.īoth functions use the format t which according to the official manual returns the number of days in the month of a given date. Known and documented that strtotime will not work accurately or give correct results after year 2038. DateTime and strtotime functions are most useful in this scenario, though it’s well PHP has already built-in functions that will help in getting the last date of a given month. PHP strtotime() to Get Last Date of Month.PHP DateTime to Get the Last Date of the Month.Get the Last Day of the Month With PHP FunctionsĬreated: February-25, 2020 | Updated: April-13, 2021. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |