@@ -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
0 commit comments