I’ve got the following code:
$query = $this->EE->db->select('*')->where('form_name', 'Newsletter')->get('freeform_entries');
$filename = "newsletter.csv";
$path = "some/path";
$delimiter = ",";
$newline = "\r\n";
$csv_data = $this->EE->dbutil->csv_from_result($query, $delimiter, $newline);
But one of those fields is a timestamp and i need to convert it to date time so that when output to csv that is how it looks. so i need 20-10-13 09:28 rather than 1357752502
Any ideas?
FROM_UNIXTIME returns a representation of the unix_timestamp argument as a value in ‘YYYY-MM-DD HH:MM:SS’:
Further info: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_from-unixtime