I have usual datetime 'enddate' column where values - 2018-09-13 23:59:59
I need to select the one in ISO 8601 format - 2018-09-13T23:59:59
Timezone set in /etc/my.cnf - default_time_zone='+00:00'
There are some answers here at Stack I tried without a success
SELECT DATE_FORMAT(NOW(),'%Y-%m-%dT%TZ')
- works for function NOW() but not for existing value
SELECT DATE_FORMAT('enddate', '%Y-%m-%dT%TZ') AS date_formatted
- returns NULL for me
So I'm looking for a real MySQL query to convert/select a value from existing datetime column, for example
SELECT DATE_FORMAT('enddate','%Y-%m-%dT%TZ') FROM tablename WHERE id=17 ;
such a query should return something like
2018-09-13T23:59:59
- but actually returns NULL
Thx for any ideas to try/correct to get a valid ISO 8601 value,
ANSWER is simple but thanks to comments below/ This query works without the quotes to define enddate as a column
SELECT DATE_FORMAT(enddate,'%Y-%m-%dT%TZ') FROM tablename WHERE id=17 ;
so I leave this question for other readers