mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +00:00
add optional parameter $format to getDateExtract()
This commit is contained in:
parent
e1c0a0cc03
commit
e807628eda
|
@ -440,13 +440,13 @@ class SeedDMS_Core_DatabaseAccess {
|
|||
* @param string $fieldname name of field containing the timestamp
|
||||
* @return string sql code
|
||||
*/
|
||||
function getDateExtract($fieldname) { /* {{{ */
|
||||
function getDateExtract($fieldname, $format='%Y-%m-%d') { /* {{{ */
|
||||
switch($this->_driver) {
|
||||
case 'mysql':
|
||||
return "from_unixtime(`".$fieldname."`, '%Y-%m-%d')";
|
||||
return "from_unixtime(`".$fieldname."`, ".$this->qstr($format).")";
|
||||
break;
|
||||
case 'sqlite':
|
||||
return "date(`".$fieldname."`, 'unixepoch')";
|
||||
return "strftime(".$this->qstr($format).", `".$fieldname."`, 'unixepoch')";
|
||||
break;
|
||||
}
|
||||
return '';
|
||||
|
|
Loading…
Reference in New Issue
Block a user