diff options
author | Andrew Dolgov <[email protected]> | 2022-07-12 22:26:21 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-07-12 22:26:21 +0300 |
commit | 80d3db1dcf8fe9ca66d4e3f2e2116d3bc39ae2b4 (patch) | |
tree | 04b33bfb9c9368c4a31e287153abec690b9014e0 /vendor/thecodingmachine/safe/deprecated/datetime.php | |
parent | 4b6161892000cb2b8392dce92a9cf2cabdf2d20e (diff) |
upgrade idiorm to php8.1-patched version (aaronpk/idiorm)
Diffstat (limited to 'vendor/thecodingmachine/safe/deprecated/datetime.php')
-rw-r--r-- | vendor/thecodingmachine/safe/deprecated/datetime.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/thecodingmachine/safe/deprecated/datetime.php b/vendor/thecodingmachine/safe/deprecated/datetime.php new file mode 100644 index 000000000..1bcb32275 --- /dev/null +++ b/vendor/thecodingmachine/safe/deprecated/datetime.php @@ -0,0 +1,36 @@ +<?php + +namespace Safe; + +use Safe\Exceptions\DatetimeException; + +/** + * Identical to the date function except that + * the time returned is Greenwich Mean Time (GMT). + * + * @param string $format The format of the outputted date string. See the formatting + * options for the date function. + * @param int $timestamp The optional timestamp parameter is an + * integer Unix timestamp that defaults to the current + * local time if a timestamp is not given. In other + * words, it defaults to the value of time. + * @return string Returns a formatted date string. If a non-numeric value is used for + * timestamp, FALSE is returned and an + * E_WARNING level error is emitted. + * @throws DatetimeException + * @deprecated The Safe version of this function is no longer needed in PHP 8.0+ + * + */ +function gmdate(string $format, int $timestamp = null): string +{ + error_clear_last(); + if ($timestamp !== null) { + $result = \gmdate($format, $timestamp); + } else { + $result = \gmdate($format); + } + if ($result === false) { + throw DatetimeException::createFromPhpError(); + } + return $result; +} |