I want to change the date format which is fetched from database.
now I got 2016-10-01{{$user->from_date}} .I want to change the format \'d-m-y\' in laravel
Method One:
Using the strtotime() to time is the best format to change the date to the given format.
strtotime() - Parse about any English textual datetime description into a Unix timestamp
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in now, or the current time if now is not supplied.
Example:
Output:
2007-02-26
Method Two:
date_format() - Return a new DateTime object, and then format the date:
Output:
2013/03/15 00:00:00