Reputation: 109
I would like to convert a java.util.Date
to something more user friendly using PHP. Is there a way of doing this using PHP?
I tried doing something like:
$created = date("F j, Y, g:i a", $issue_fields['created_date']);
but it complained with an error that looks like:
Notice: A non well formed numeric value encountered in C:\wamp\www\PHP\get_tickets.php on line 49
Unfortunately, I don't have control over the date format I received. The format looks like:
2013-01-22T11:46:24.000-0800
and I would like something more like September 24, 2011, 6:39 am. Is this possible?
Thanks!
Upvotes: 0
Views: 922
Reputation: 1190
It looks like the given date is in ISO 8601 format. You should be able to convert this to a date object using strtotime:
echo date("F j, Y, g:i a", strtotime('2013-01-22T11:46:24.000-0800'));
This yields: January 22, 2013, 11:46 am
Upvotes: 2