I have a field in my database that stores a date as a VARCHAR that looks like this:
2014-10-09T07:10:46
I'm trying to convert that into a date and display it as %Y-%M by doing the following;
'Month' => array(
'chart' => 'line',
'fields' => array(
array(
'field' => 'date_format(str_to_date(cd.field_closed_date_value,\'%Y-%M-%dT%H:%i:%S\'), \'%Y-%m\')',
'alias' => 'month',
'label' => 'Month',
'type' => 'string',
'sort' => 'ASC',
),
),
),
The original code that worked was like this:
'Day' => array(
'chart' => 'line',
'fields' => array(
array(
'field' => 'date_format(from_unixtime(n.created), \'%Y-%m-%d\')',
'alias' => 'day',
'label' => 'Day',
'type' => 'string',
'sort' => 'ASC',
),
),
),
But that code uses the created date and I'm needing to use the closed date, which isn't in the same format. I know I've probably got this really wrong, I'm trying to work with what was here when I took on this project, any help is appreciated.