Reputation: 1698
I have following MySQL datetime:
2012-04-13 09:45:36
I am converting it into ISO 8601 date format using
date(DATE_ISO8601, strtotime('2012-04-13 09:45:36'));
It gives me following output:
2012-04-13T09:45:36+0100
How can I get output without offset i.e. without +0100
I just want to get 2012-04-13T09:45:36
Can datetime be affected if I get it after removing the offset?
Upvotes: 0
Views: 772
Reputation: 262
You have to build the date format with the formatting parameter you need.
date(DATE_ISO8601, strtotime('2012-04-13 09:45:36'));
is the same as date('Y-m-d\TH:i:sO', strtotime('2012-04-13 09:45:36'));
. If you remove the O
parameter (offset to GMT) you will get the result you need:
date('Y-m-d\TH:i:s', strtotime('2012-04-13 09:45:36'));
Upvotes: 1