mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Add getInternalDateTime() and getDisplayDateTime() functions
This commit is contained in:
parent
b7c921bd0a
commit
a75eb80f8e
1 changed files with 26 additions and 0 deletions
|
|
@ -602,6 +602,32 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = false)
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Unix timestamp to YYYYMMDDHHIISS format, using the internal time zone.
|
||||
* If the timestamp is not given, the current time is used.
|
||||
*
|
||||
* @param int $timestamp Unix timestamp
|
||||
* @return string
|
||||
*/
|
||||
function getInternalDateTime($timestamp = null, $format = 'YmdHis')
|
||||
{
|
||||
$timestamp = ($timestamp !== null) ? $timestamp : time();
|
||||
return Rhymix\Framework\DateTime::formatTimestamp($format, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Unix timestamp to YYYYMMDDHHIISS format, using the internal time zone.
|
||||
* If the timestamp is not given, the current time is used.
|
||||
*
|
||||
* @param int $timestamp Unix timestamp
|
||||
* @return string
|
||||
*/
|
||||
function getDisplayDateTime($timestamp = null, $format = 'YmdHis')
|
||||
{
|
||||
$timestamp = ($timestamp !== null) ? $timestamp : time();
|
||||
return Rhymix\Framework\DateTime::formatTimestampForCurrentUser($format, $timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the recent post within a day, output format of YmdHis is "min/hours ago from now". If not within a day, it return format string.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue