add new method getDateExtract()

This commit is contained in:
Uwe Steinmann 2014-04-08 15:27:51 +02:00
parent eb4f49af8a
commit 151c3dd8f2

View File

@ -432,6 +432,26 @@ class SeedDMS_Core_DatabaseAccess {
}
return false;
} /* }}} */
/**
* Return sql statement for extracting the date part from a field
* containing a unix timestamp
*
* @param string $fieldname name of field containing the timestamp
* @return string sql code
*/
function getDateExtract($fieldname) { /* {{{ */
switch($this->_driver) {
case 'mysql':
return "from_unixtime(`".$fieldname."`, '%Y-%m-%d')";
break;
case 'sqlite':
return "date(`".$fieldname."`, 'unixepoch')";
break;
}
return '';
} /* }}} */
}
?>