Reputation: 6509
My API outputs the DateTime in the following format:
2018-06-17T09:07:00Z
How do I display this in a more meaningful way, say, 17/06/2018
.
I looked at the Manual: http://php.net/manual/en/datetime.formats.date.php however still wasn't able to find a way to achieve this.
$eventStart = "2018-06-17T09:07:00Z";
Upvotes: 1
Views: 74
Reputation: 11
Format the date, but first convert the string to time.
echo date('d/m/Y', strtotime($inputDate));
Upvotes: 1
Reputation: 2328
Convert the string in time and then format the date which you want
$date = '2018-06-17T09:07:00Z';
echo date('d/m/Y', strtotime($date));
Upvotes: 1
Reputation:
Use Date Format :
$inputDate = "2018-06-17T09:07:00Z";
echo date('d/m/Y', strtotime($inputDate));
Upvotes: 1
Reputation: 1310
Use Below code.
date('d/m/Y', strtotime('2018-06-17T09:07:00Z'));
Upvotes: 1
Reputation: 3997
You can format it like the below code in PHP:
echo date('d/m/Y', strtotime('2018-06-17T09:07:00Z'));
Upvotes: 1