X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FTemporal.php;h=8deadd5e8f4cb9665734e76675ca9dc9a6f8e09d;hb=a2ee2b56d219846d43a2214fbf9cbb9e325e5826;hp=37be4eb919ae4d156301298dd9492a0e5cb00910;hpb=89602e44da535697dcf33aa37e43cce317d4830c;p=friendica.git diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 37be4eb919..8deadd5e8f 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -136,7 +136,7 @@ class Temporal } /** - * convert() shorthand for UTC now. + * convert() shorthand for timezoned now. * * @param string $format DateTime format string or Temporal constant * @return string @@ -146,6 +146,17 @@ class Temporal return self::convert('now', $timezone, 'UTC', $format); } + /** + * convert() shorthand for local now. + * + * @param string $format DateTime format string or Temporal constant + * @return string + */ + public static function localNow($format = self::MYSQL) + { + return self::convert('now', date_default_timezone_get(), 'UTC', $format); + } + /** * convert() shorthand for UTC now. * @@ -542,8 +553,8 @@ class Temporal 'October', 'November', 'December' ]; - $thisyear = self::timezoneNow(date_default_timezone_get(), 'Y'); - $thismonth = self::timezoneNow(date_default_timezone_get(), 'm'); + $thisyear = self::localNow('Y'); + $thismonth = self::localNow('m'); if (!$y) { $y = $thisyear; } @@ -560,7 +571,7 @@ class Temporal $started = false; if (($y == $thisyear) && ($m == $thismonth)) { - $tddate = intval(self::timezoneNow(date_default_timezone_get(), 'j')); + $tddate = intval(self::localNow('j')); } $str_month = day_translate($mtab[$m]);