mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Add DateTime::formatTimestamp() method using the internal timezone
This commit is contained in:
parent
540e1ff9d5
commit
b7c921bd0a
1 changed files with 13 additions and 0 deletions
|
|
@ -12,6 +12,19 @@ class DateTime
|
|||
*/
|
||||
protected static $_timezones = array();
|
||||
|
||||
/**
|
||||
* Format a Unix timestamp using the internal timezone.
|
||||
*
|
||||
* @param string $format Format used in PHP date() function
|
||||
* @param int $timestamp Unix timestamp (optional, default is now)
|
||||
* @return string
|
||||
*/
|
||||
public static function formatTimestamp($format, $timestamp = null)
|
||||
{
|
||||
$offset = Config::get('locale.internal_timezone') ?: date('Z', $timestamp);
|
||||
return gmdate($format, $timestamp + $offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a Unix timestamp for the current user's timezone.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue