Query that converts a timestamp to a date Is it possible to convert a timestamp to a date format in a query?

This is the code I am using.

$query = db_select('my_submissions', 's');
$query-&gt;fields('s', array('sid','name','company','email','phone','is_customer','submitted','count'));
$entries = $query-&gt;execute();

$rows = array();
foreach ($entries as $entry) {
  $row = array_map('check_plain', (array) $entry);
  $row['submitted'] = $row['submitted'] ? date('d.m.Y H:i', $row['submitted']) : "";
  $rows[] = $row;
}
$select-&gt;addExpression("DATE_FORMAT(FROM_UNIXTIME(submitted), '%d.%m.%Y %H:%i')", 'submitted_formatted');


http://www.w3schools.com/sql/func_date_format.asp

then in your loop, reference it as $row['submitted_formatted'];