Just a simple question. How do I convert a PHP ISO time (like 2010-06-23T20:47:48-04:00) to something more readable? Is there a function already built in PHP? I've looked around but I haven't seen anything to convert times. If there's not a function, is it possible?
Thank you
Date. toUTCString() - returns the date and time in the format day, dd month yyyy hh:mm:ss GMT. Date. toISOString() - returns the date and time in the format yyyy-mm-ddThh:mm:ss.
Change YYYY-MM-DD to DD-MM-YYYY In the below example, we have date 2019-09-15 in YYYY-MM-DD format, and we will convert this to 15-09-2019 in DD-MM-YYYY format. $orgDate = "2019-09-15"; $newDate = date("d-m-Y", strtotime($orgDate)); echo "New date format is: ".
After PHP 5 you can use this: echo date("c"); form ISO 8601 formatted datetime. Note for comments: Regarding to this, both of these expressions are valid for timezone, for basic format: ±[hh]:[mm], ±[hh][mm], or ±[hh] .
Use the getTime() method to convert an ISO date to a timestamp, e.g. new Date(isoStr). getTime() . The getTime method returns the number of milliseconds since the Unix Epoch and always uses UTC for time representation. Copied!
$format = "d M Y"; //or something else that date() accepts as a format
date_format(date_create($time), $format);
Try this:
echo date( "Y-m-d H:i:s", strtotime("2010-06-23T20:47:48-04:00") );
Format this part "Y-m-d H:i:s" using format
from this documentation http://php.net/manual/en/function.date.php
echo strftime("%b %e %Y at %l:%M %p", strtotime($ios));
will do
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With