mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
parameter of getReadableDate() is optional, add makeTsFromDate()
This commit is contained in:
parent
efe6fe085d
commit
d624b3c9ef
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user