< TIMESTAMP: Setting Literal Data Type   (Previous) Table of Contents (Next)   TIMESTAMP: Supported Ranges >

TIMESTAMP: Getting Literal Data Type

/**
 * the sprintf() format string needed to modify a SELECT query statement
 * so it returns a DATE column in YYYY-MM-DD HH:MM:SS format
 *
 * @return  string   the query fragment your DBMS needs
 */
function getTimestampLiteralType() {
    return $this->TimestampLiteralType;
}

require 'connect.inc';

$query = 'INSERT INTO t (daf, tf) VALUES (' .
         $p->getDateLiteralType() . "'1980-01-01', " .
         $p->getTimestampLiteralType() . " '2004-11-10 15:30:00')";
echo $query;
$db->query($query);
$db->query("DELETE FROM t WHERE cf = 'n/a'");
fbsql
INSERT INTO t (daf, tf) VALUES ( DATE '1980-01-01', TIMESTAMP '2004-11-10 15:30:00')
mysql
INSERT INTO t (daf, tf) VALUES ( '1980-01-01', '2004-11-10 15:30:00')