How can I convert 2012-01-18T11:45:00+01:00
(ISO 8601) to 1326883500
(unixtimestamp) in PHP?
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!
Use the Date() constructor to convert an ISO string to a date object, e.g. new Date('2023-07-21T09:35:31.820Z') . The Date() constructor will easily parse the ISO 8601 string and will return a Date object. Copied! We used the Date() constructor to create a Date object from an ISO string.
Time zones in ISO 8601 are represented as local time (with the location unspecified), as UTC, or as an offset from UTC.
echo date("U",strtotime('2012-01-18T11:45:00+01:00'));
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