mirror of
https://github.com/friendica/friendica
synced 2025-04-28 03:10:11 +00:00
Add Temporal::local() shorthand for Temporal::convert()
This commit is contained in:
parent
25954314ec
commit
0bee706e51
11 changed files with 48 additions and 36 deletions
|
@ -135,6 +135,18 @@ class Temporal
|
|||
return self::convert($time, 'UTC', 'UTC', $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert() shorthand for local.
|
||||
*
|
||||
* @param string $time A date/time string
|
||||
* @param string $format DateTime format string or Temporal constant
|
||||
* @return string
|
||||
*/
|
||||
public static function local($time, $format = self::MYSQL)
|
||||
{
|
||||
return self::convert($time, date_default_timezone_get(), 'UTC', $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* convert() shorthand for timezoned now.
|
||||
*
|
||||
|
@ -154,7 +166,7 @@ class Temporal
|
|||
*/
|
||||
public static function localNow($format = self::MYSQL)
|
||||
{
|
||||
return self::convert('now', date_default_timezone_get(), 'UTC', $format);
|
||||
return self::local('now', $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,7 +177,7 @@ class Temporal
|
|||
*/
|
||||
public static function utcNow($format = self::MYSQL)
|
||||
{
|
||||
return self::convert('now', 'UTC', 'UTC', $format);
|
||||
return self::utc('now', $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue