Skip to content

Commit f531da1

Browse files
committed
regenerated the files
1 parent 291d8de commit f531da1

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

generated/datetime.php

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,69 @@ function date_sunset(int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, fl
357357
}
358358

359359

360+
/**
361+
* Returns a string formatted according to the given format string using the
362+
* given integer timestamp or the current time
363+
* if no timestamp is given. In other words, timestamp
364+
* is optional and defaults to the value of time.
365+
*
366+
* @param string $format Format accepted by DateTimeInterface::format.
367+
* @param int $timestamp The optional timestamp parameter is an
368+
* integer Unix timestamp that defaults to the current
369+
* local time if a timestamp is not given. In other
370+
* words, it defaults to the value of time.
371+
* @return string Returns a formatted date string. If a non-numeric value is used for
372+
* timestamp, FALSE is returned and an
373+
* E_WARNING level error is emitted.
374+
* @throws DatetimeException
375+
*
376+
*/
377+
function date(string $format, int $timestamp = null): string
378+
{
379+
error_clear_last();
380+
if ($timestamp !== null) {
381+
$result = \date($format, $timestamp);
382+
} else {
383+
$result = \date($format);
384+
}
385+
if ($result === false) {
386+
throw DatetimeException::createFromPhpError();
387+
}
388+
return $result;
389+
}
390+
391+
392+
/**
393+
* Identical to the date function except that
394+
* the time returned is Greenwich Mean Time (GMT).
395+
*
396+
* @param string $format The format of the outputted date string. See the formatting
397+
* options for the date function.
398+
* @param int $timestamp The optional timestamp parameter is an
399+
* integer Unix timestamp that defaults to the current
400+
* local time if a timestamp is not given. In other
401+
* words, it defaults to the value of time.
402+
* @return string Returns a formatted date string. If a non-numeric value is used for
403+
* timestamp, FALSE is returned and an
404+
* E_WARNING level error is emitted.
405+
* @throws DatetimeException
406+
*
407+
*/
408+
function gmdate(string $format, int $timestamp = null): string
409+
{
410+
error_clear_last();
411+
if ($timestamp !== null) {
412+
$result = \gmdate($format, $timestamp);
413+
} else {
414+
$result = \gmdate($format);
415+
}
416+
if ($result === false) {
417+
throw DatetimeException::createFromPhpError();
418+
}
419+
return $result;
420+
}
421+
422+
360423
/**
361424
* Returns the Unix timestamp corresponding to the arguments
362425
* given. This timestamp is a long integer containing the number of

generated/functionsList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
'curl_share_errno',
6868
'curl_share_setopt',
6969
'curl_unescape',
70+
'date',
7071
'date_parse',
7172
'date_parse_from_format',
7273
'date_sunrise',
@@ -191,6 +192,7 @@
191192
'getprotobynumber',
192193
'get_headers',
193194
'glob',
195+
'gmdate',
194196
'gmp_binomial',
195197
'gmp_export',
196198
'gmp_import',

rector-migrate-0.7.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
'curl_share_errno' => 'Safe\curl_share_errno',
7878
'curl_share_setopt' => 'Safe\curl_share_setopt',
7979
'curl_unescape' => 'Safe\curl_unescape',
80+
'date' => 'Safe\date',
8081
'date_parse' => 'Safe\date_parse',
8182
'date_parse_from_format' => 'Safe\date_parse_from_format',
8283
'date_sunrise' => 'Safe\date_sunrise',
@@ -201,6 +202,7 @@
201202
'getprotobynumber' => 'Safe\getprotobynumber',
202203
'get_headers' => 'Safe\get_headers',
203204
'glob' => 'Safe\glob',
205+
'gmdate' => 'Safe\gmdate',
204206
'gmp_binomial' => 'Safe\gmp_binomial',
205207
'gmp_export' => 'Safe\gmp_export',
206208
'gmp_import' => 'Safe\gmp_import',

0 commit comments

Comments
 (0)