mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +00:00
add new method getDateExtract()
This commit is contained in:
parent
eb4f49af8a
commit
151c3dd8f2
|
@ -432,6 +432,26 @@ class SeedDMS_Core_DatabaseAccess {
|
||||||
}
|
}
|
||||||
return false;
|
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 '';
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user