< DATE: Setting Query Format   (Previous) Table of Contents (Next)   DATE: Literal Data Type >

DATE: Formatting Query

/**
 * Returns the query string fragment needed for the current DBMS to
 * produce an ISO formatted date from a date column
 *
 * @param   string   $col  the database column to get the data from
 * @return  string   the query fragment your DBMS needs
 */
function formatDateQuery($col) {
    return sprintf($this->DateQueryFormat, $col);
}

require 'connect.inc';

$query = 'SELECT ' . $p->formatDateQuery('daf') . ' FROM t';
echo "$query\n";
$out = $db->getOne($query);
echo $out;
mssql
SELECT CONVERT(CHAR(10), daf, 120) FROM t
1960-06-07
fbsql
SELECT daf FROM t
1960-06-07