add function getConvertDateFormat()

This commit is contained in:
Uwe Steinmann 2020-12-17 11:42:20 +01:00
parent 2cc6ca95e9
commit b9ad6e250f

View File

@ -26,6 +26,21 @@ function formatted_size($size_bytes) { /* {{{ */
return number_format($size_bytes,0,"","")." Bytes"; return number_format($size_bytes,0,"","")." Bytes";
} /* }}} */ } /* }}} */
/* Date picker needs a different syntax for date formats using
* yyyy for %Y
* yy for %y
* mm for %m
* dd for %d
* This functions returns the converted format
*/
function getConvertDateFormat() {
global $settings;
if($settings->_dateformat) {
return str_replace(['y', 'Y', 'm', 'M', 'F', 'd', 'l', 'D'], ['yy', 'yyyy', 'mm', 'M', 'MM', 'dd', 'DD', 'D'], $settings->_dateformat);
} else
return 'yyyy-mm-dd';
}
function getReadableDate($timestamp) { /* {{{ */ function getReadableDate($timestamp) { /* {{{ */
global $settings; global $settings;
if(!is_numeric($timestamp)) if(!is_numeric($timestamp))