php change date format 1

php change date format

To convert the date-time format PHP provides strtotime() and date() function. We change the date format from one format to another.

Change YYYY-MM-DD to DD-MM-YYYY

Here is what the above code is Doing:
1. We have a date in YYYY-MM-DD format.
2. We use strtotime() function to convert the date into a timestamp.
3. We use date() function to convert the timestamp into a new date format.

Similar Posts