diff --git a/inc/inc.Utils.php b/inc/inc.Utils.php index 0747c4abe..4e90b65c2 100644 --- a/inc/inc.Utils.php +++ b/inc/inc.Utils.php @@ -41,9 +41,11 @@ function getConvertDateFormat() { return 'yyyy-mm-dd'; } -function getReadableDate($timestamp) { /* {{{ */ +function getReadableDate($timestamp=0) { /* {{{ */ global $settings; - if(!is_numeric($timestamp)) + if(!$timestamp) + $timestamp = time(); + elseif(!is_numeric($timestamp)) $timestamp = strtotime($timestamp); if($settings->_dateformat) return date($settings->_dateformat, $timestamp); @@ -84,6 +86,16 @@ function getPeriodOfTime($timestamp) { /* {{{ */ } } /* }}} */ +/* + * Converts a date string into a timestamp + * + * @param $date string date in format understood by strftime + * @return integer/boolean unix timestamp or false in case of an error + */ +function makeTsFromDate($date) { /* {{{ */ + return strtotime($date); +} /* }}} */ + /* * Converts a date/time string into a timestamp * @@ -91,6 +103,7 @@ function getPeriodOfTime($timestamp) { /* {{{ */ * @return integer/boolean unix timestamp or false in case of an error */ function makeTsFromLongDate($date) { /* {{{ */ + return strtotime($date); $tmp = explode(' ', $date); if(count($tmp) != 2) return false;