]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/DateTimeFormat.php
Merge pull request #11490 from annando/issue-11487
[friendica.git] / src / Util / DateTimeFormat.php
index cf3216a152c8c5ebc3b2cfdf8758f719feeeaf46..41cd16d2f41464bc692a63963b6109ba1e37dee1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -35,6 +35,7 @@ class DateTimeFormat
        const MYSQL = 'Y-m-d H:i:s';
        const HTTP  = 'D, d M Y H:i:s \G\M\T';
        const JSON  = 'Y-m-d\TH:i:s.v\Z';
+       const API   = 'D M d H:i:s +0000 Y';
 
        static $localTimezone = 'UTC';
 
@@ -51,7 +52,7 @@ class DateTimeFormat
         * @return string
         * @throws Exception
         */
-       public static function utc($time, $format = self::MYSQL)
+       public static function utc(string $time, string $format = self::MYSQL): string
        {
                return self::convert($time, 'UTC', 'UTC', $format);
        }
@@ -101,7 +102,7 @@ class DateTimeFormat
         * @return string
         * @throws Exception
         */
-       public static function utcNow($format = self::MYSQL)
+       public static function utcNow(string $format = self::MYSQL): string
        {
                return self::utc('now', $format);
        }