Update ext_datetime to return darrays
[hiphop-php.git] / hphp / runtime / ext / datetime / ext_datetime.php
blobb99c7ae8d98ed248e91d8b0be04ebee23fe50534
1 <?hh
3 /**
4 * Representation of date and time.
6 */
7 <<__NativeData("DateTime")>>
8 class DateTime implements DateTimeInterface {
10 /**
11 * Add an interval to a datetime object
13 * @param DateInterval $interval - DateInterval object containing the time to
14 * add.
16 * @return DateTime - Returns the DateTime object for method chaining
19 <<__Native>>
20 function add(DateInterval $interval): mixed;
22 <<__Native>>
23 function __construct(string $time = "now",
24 ?DateTimeZone $timezone = null): void;
26 /**
27 * Parse a date according to a format and create a DateTime object
29 * @param string $format - DateTime format specifier
30 * @param string $time - Date and time to parse
31 * @param DateTimeZone $timezone - DateTimeZone for the given time
33 * @return mixed - Returns a new DateTime instance or FALSE on failure.
36 <<__Native>>
37 static function createFromFormat(string $format,
38 string $time,
39 ?DateTimeZone $timezone = null): mixed;
41 /**
42 * Find the interval between two DateTime objects
44 * @param DateTimeInterface $datetime2 - DateTime object to compare agains
45 * @param bool $absolute - Whether to return absolute difference
47 * @return DateInterval - Returns a DateInterval object representing the
48 * distance between two times
51 <<__Native>>
52 function diff(mixed $datetime2, mixed $absolute = false): mixed;
54 /**
55 * Returns date formatted according to given format.
57 * @param string $format - DateTime object returned by date_create()
59 * @return string - Returns the formatted date string on success or FALSE on
60 * failure.
63 <<__Native>>
64 function format(mixed $format): string;
66 /**
67 * Returns the last errors encountered by the datetime extension
69 * @return array - Vector of error messages
72 <<__Native>>
73 static function getLastErrors(): darray;
75 /**
76 * Returns the timezone offset.
78 * @return int - Returns the timezone offset in seconds from UTC on success
79 * or FALSE on failure.
82 <<__Native>>
83 function getOffset(): int;
85 /**
86 * Returns the unix timestamp representing the date.
88 * @return int - Epoch representing the datetime object
91 <<__Native>>
92 function getTimestamp(): int;
94 /**
95 * Return time zone relative to given DateTime.
97 * @return mixed - Returns a DateTimeZone object on success or FALSE on
98 * failure.
101 <<__Native>>
102 function getTimezone(): mixed;
105 * Alter the timestamp of a DateTime object by incrementing or
106 * decrementing in a format accepted by strtotime().
108 * @param string $modify - DateTime object returned by date_create(). The
109 * function modifies this object.
111 * @return DateTime - Returns the modified DateTime object or FALSE on
112 * failure.
115 <<__Native>>
116 function modify(string $modify): mixed;
119 * Resets the current date of the DateTime object to a different date.
121 * @param int $year - DateTime object returned by date_create(). The
122 * function modifies this object.
123 * @param int $month - Year of the date.
124 * @param int $day - Month of the date.
126 * @return DateTime - Returns the modified DateTime object or FALSE on
127 * failure.
130 <<__Native>>
131 function setDate(int $year, int $month, int $day): DateTime;
134 * Set a date according to the ISO 8601 standard - using weeks and day
135 * offsets rather than specific dates.
137 * @param int $year - DateTime object returned by date_create(). The
138 * function modifies this object.
139 * @param int $week - Year of the date.
140 * @param int $day - Week of the date.
142 * @return DateTime - Returns the modified DateTime object or FALSE on
143 * failure.
146 <<__Native>>
147 function setISODate(int $year, int $week, int $day = 1): DateTime;
150 * Resets the current time of the DateTime object to a different time.
152 * @param int $hour - DateTime object returned by date_create(). The
153 * function modifies this object.
154 * @param int $minute - Hour of the time.
155 * @param int $second - Minute of the time.
157 * @return DateTime - Returns the modified DateTime object or FALSE on
158 * failure.
161 <<__Native>>
162 function setTime(int $hour, int $minute, int $second = 0): DateTime;
165 * Set the DateTime object according to the timestamp provided
167 * @param int $unixtimestamp - Unix timestamp to update the DateTime object
168 * to.
170 * @return DateTime - Returns the DateTime object for method chaining
173 <<__Native>>
174 function setTimestamp(int $unixtimestamp): DateTime;
177 * @param DateTimeZone $timezone - DateTime object returned by date_create().
178 * The function modifies this object.
180 * @return DateTime - Returns the modified DateTime object or FALSE on
181 * failure.
184 <<__Native>>
185 function setTimezone(DateTimeZone $timezone): mixed;
188 * Subtract an interval from a datetime object
190 * @param DateInterval $interval - DateInterval object containing the time to
191 * subtract.
193 * @return DateTime - Returns the DateTime object for method chaining
196 <<__Native>>
197 function sub(DateInterval $interval): mixed;
199 <<__Native>>
200 function __sleep(): array;
202 <<__Native>>
203 function __wakeup(): void;
205 <<__Native>>
206 function __debugInfo(): array;
211 * Representation of time zone.
214 <<__NativeData("DateTimeZone")>>
215 class DateTimeZone {
218 * @param string $timezone
221 <<__Native>>
222 function __construct(string $timezone): void;
225 * Returns location information for a timezone
227 * @return array - Array containing location information about timezone.
230 <<__Native>>
231 function getLocation(): darray;
234 * Returns the name of the timezone.
236 * @return string - One of timezones.
239 <<__Native>>
240 function getName(): string;
243 * This function returns the offset to GMT for the date/time specified in the
244 * datetime parameter. The GMT offset is calculated with the timezone
245 * information contained in the DateTimeZone object being used.
247 * @param DateTimeInterface $datetime - DateTimeZone object returned by
248 * timezone_open()
250 * @return int - Returns time zone offset in seconds on success or FALSE on
251 * failure.
254 <<__Native>>
255 function getOffset(DateTimeInterface $datetime): mixed;
258 * @return array - Returns numerically indexed array containing associative
259 * array with all transitions on success or FALSE on failure.
262 <<__Native>>
263 function getTransitions(int $timestamp_begin = PHP_INT_MIN,
264 int $timestamp_end = PHP_INT_MAX): mixed;
267 * @return array - Returns array on success or FALSE on failure.
270 <<__Native>>
271 static function listAbbreviations(): array;
274 * @param int $what - One of DateTimeZone class constants.
275 * @param string $country - The timestamp which is used as a base for the
276 * calculation of relative dates.
278 * @return mixed - Returns array on success or FALSE on failure.
281 <<__Native>>
282 static function listIdentifiers(int $what = 2047,
283 string $country = ""): mixed;
285 <<__Native>>
286 function __debugInfo(): array;
290 * Represents a date interval.
293 <<__NativeData("DateInterval")>>
294 class DateInterval {
297 * Creates a new DateInterval object
299 * @param string $interval_spec
302 <<__Native>>
303 function __construct(string $interval_spec): void;
306 * Retreives interval partials (y, m, d, etc...)
308 * @param mixed $member - One of 'y', 'm', 'd', 'h', 'i', 's', 'invert', or
309 * 'days'. All other vales will return null and throw undefined property
310 * notice.
312 * @return mixed - Number of years, months, days, hours, minutes, seconds,
313 * or total days for DateInterval, or true/false for date inversion.
316 <<__Native>>
317 function __get(mixed $member): mixed;
320 * Sets interval partials (y, m, d, etc...)
322 * @param mixed $member - One of 'y', 'm', 'd', 'h', 'i', 's', 'invert', or
323 * 'days'. All other vales will throw undefined property notice and ignore
324 * value.
325 * @param mixed $value - Either a boolean for 'invert', or a number.
327 * @return mixed - Always returns NULL.
330 <<__Native>>
331 function __set(mixed $member, mixed $value): mixed;
334 * Sets up a DateInterval from the relative parts of the string
336 * @param string $time - A date with relative parts. Specifically, the
337 * relative formats supported by the parser used for strtotime() and
338 * DateTime will be used to construct the DateInterval.
340 * @return DateInterval - Returns a new DateInterval instance.
343 <<__Native>>
344 static function createFromDateString(string $time): DateInterval;
347 * Formats the interval
349 * @param string $format - DateInterval format specifier.
351 * @return string - Returns the formatted interval.
354 <<__Native>>
355 function format(string $format): string;
359 * Checks the validity of the date formed by the arguments. A date is
360 * considered valid if each parameter is properly defined.
362 * @param int $month - The month is between 1 and 12 inclusive.
363 * @param int $day - The day is within the allowed number of days for the
364 * given month. Leap years are taken into consideration.
365 * @param int $year - The year is between 1 and 32767 inclusive.
367 * @return bool - Returns TRUE if the date given is valid; otherwise returns
368 * FALSE.
371 <<__ParamCoerceModeFalse, __Native>>
372 function checkdate(int $month, int $day, int $year): bool;
374 function date_add(DateTime $datetime, DateInterval $interval): mixed {
375 return $datetime->add($interval);
378 function date_create_from_format(string $format,
379 string $time,
380 ?DateTimeZone $timezone = null): mixed {
381 return DateTime::createFromFormat($format, $time, $timezone);
384 <<__ParamCoerceModeFalse, __Native>>
385 function date_parse_from_format(string $format, string $date): mixed;
387 <<__Native>>
388 function date_create(?string $time = null,
389 ?DateTimeZone $timezone = null): mixed;
391 function date_date_set(DateTime $datetime,
392 int $year,
393 int $month,
394 int $day): void {
395 $datetime->setDate($year, $month, $day);
399 * In order of preference, this function returns the default timezone by:
400 * Reading the timezone set using the date_default_timezone_set() function (if
401 * any) Reading the TZ environment variable (if non empty) (Prior to PHP
402 * 5.3.0) Reading the value of the date.timezone ini option (if set)
403 * Querying the host operating system (if supported and allowed by the OS) If
404 * none of the above succeed, date_default_timezone_get() will return a
405 * default timezone of UTC.
407 * @return string - Returns a string.
410 <<__ParamCoerceModeFalse, __Native>>
411 function date_default_timezone_get(): string;
414 * date_default_timezone_set() sets the default timezone used by all date/time
415 * functions. Since PHP 5.1.0 (when the date/time functions were rewritten),
416 * every call to a date/time function will generate a E_NOTICE if the timezone
417 * isn't valid, and/or a E_WARNING message if using the system settings or the
418 * TZ environment variable. Instead of using this function to set the default
419 * timezone in your script, you can also use the INI setting date.timezone to
420 * set the default timezone.
422 * @param string $name - The timezone identifier, like UTC or Europe/Lisbon.
423 * The list of valid identifiers is available in the List of Supported
424 * Timezones.
426 * @return bool - This function returns FALSE if the timezone_identifier isn't
427 * valid, or TRUE otherwise.
430 <<__Native>>
431 function date_default_timezone_set(string $name): bool;
433 function date_get_last_errors(): array {
434 return DateTime::getLastErrors();
437 <<__ParamCoerceModeFalse>>
438 function date_interval_create_from_date_string(string $time): DateInterval {
439 return DateInterval::createFromDateString($time);
442 <<__ParamCoerceModeFalse>>
443 function date_interval_format(DateInterval $interval,
444 string $format_spec): string {
445 return $interval->format($format_spec);
448 <<__ParamCoerceModeFalse>>
449 function date_isodate_set(DateTime $datetime,
450 int $year,
451 int $week,
452 int $day = 1): void {
453 return $datetime->setISODate($year, $week, $day);
456 <<__ParamCoerceModeFalse, __Native>>
457 function date_format(DateTime $datetime, string $format): mixed;
459 <<__ParamCoerceModeFalse>>
460 function date_modify(DateTime $datetime, string $modify): void {
461 $datetime->modify($modify);
465 * @param string $date - Date in format accepted by strtotime().
467 * @return mixed - Returns array with information about the parsed date on
468 * success or FALSE on failure.
471 <<__ParamCoerceModeFalse, __Native>>
472 function date_parse(string $date): mixed;
474 <<__ParamCoerceModeFalse>>
475 function date_sub(DateTime $datetime, DateInterval $interval): mixed {
476 return $datetime->sub($interval);
480 * @param int $ts - Timestamp.
481 * @param float $latitude - Latitude in degrees.
482 * @param float $longitude - Longitude in degrees.
484 * @return array - Returns array on success or FALSE on failure.
487 <<__ParamCoerceModeFalse, __Native>>
488 function date_sun_info(int $ts, float $latitude, float $longitude): array;
491 * date_sunrise() returns the sunrise time for a given day (specified as a
492 * timestamp) and location.
494 * @param int $timestamp - The timestamp of the day from which the sunrise
495 * time is taken.
496 * @param int $format - format constants constant description example
497 * SUNFUNCS_RET_STRING returns the result as string 16:46 SUNFUNCS_RET_DOUBLE
498 * returns the result as float 16.78243132 SUNFUNCS_RET_TIMESTAMP returns the
499 * result as integer (timestamp) 1095034606
500 * @param float $latitude - Defaults to North, pass in a negative value for
501 * South. See also: date.default_latitude
502 * @param float $longitude - Defaults to East, pass in a negative value for
503 * West. See also: date.default_longitude
504 * @param float $zenith - Default: date.sunrise_zenith
505 * @param float $gmt_offset - Specified in hours.
507 * @return mixed - Returns the sunrise time in a specified format on success
508 * or FALSE on failure.
511 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
512 function date_sunrise(int $timestamp,
513 int $format = SUNFUNCS_RET_STRING,
514 float $latitude = 0.0,
515 float $longitude = 0.0,
516 float $zenith = 0.0,
517 float $gmt_offset = 0.0): mixed;
520 * date_sunset() returns the sunset time for a given day (specified as a
521 * timestamp) and location.
523 * @param int $timestamp - The timestamp of the day from which the sunset time
524 * is taken.
525 * @param int $format - format constants constant description example
526 * SUNFUNCS_RET_STRING returns the result as string 16:46 SUNFUNCS_RET_DOUBLE
527 * returns the result as float 16.78243132 SUNFUNCS_RET_TIMESTAMP returns the
528 * result as integer (timestamp) 1095034606
529 * @param float $latitude - Defaults to North, pass in a negative value for
530 * South. See also: date.default_latitude
531 * @param float $longitude - Defaults to East, pass in a negative value for
532 * West. See also: date.default_longitude
533 * @param float $zenith - Default: date.sunset_zenith
534 * @param float $gmt_offset - Specified in hours.
536 * @return mixed - Returns the sunset time in a specified format on success or
537 * FALSE on failure.
540 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
541 function date_sunset(int $timestamp,
542 int $format = SUNFUNCS_RET_STRING,
543 float $latitude = 0.0,
544 float $longitude = 0.0,
545 float $zenith = 0.0,
546 float $gmt_offset = 0.0): mixed;
548 <<__ParamCoerceModeFalse>>
549 function date_time_set(DateTime $datetime,
550 int $hour,
551 int $minute,
552 int $second = 0): void {
553 $datetime->setTime($hour, $minute, $second);
556 <<__ParamCoerceModeFalse>>
557 function date_timestamp_set(DateTime $datetime, int $timestamp): DateTime {
558 return $datetime->setTimestamp($timestamp);
561 <<__ParamCoerceModeFalse>>
562 function date_timezone_set(DateTime $datetime, DateTimeZone $timezone): mixed {
563 return $datetime->setTimezone($timezone);
567 * Returns a string formatted according to the given format string using the
568 * given integer timestamp or the current time if no timestamp is given. In
569 * other words, timestamp is optional and defaults to the value of time().
571 * @return mixed - Returns a formatted date string. If a non-numeric value is
572 * used for timestamp, FALSE is returned and an E_WARNING level error is
573 * emitted.
576 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
577 function date(string $format, int $timestamp = -1): mixed;
580 * Returns an associative array containing the date information of the
581 * timestamp, or the current local time if no timestamp is given.
583 * @param int $timestamp - The optional timestamp parameter is an integer Unix
584 * timestamp that defaults to the current local time if a timestamp is not
585 * given. In other words, it defaults to the value of time().
587 * @return array
590 <<__Native("NumArgs")>>
591 function getdate(int $timestamp = -1): array;
594 * This is an interface to gettimeofday(2). It returns an associative array
595 * containing the data returned from the system call.
597 * @param bool $return_float - When set to TRUE, a float instead of an array
598 * is returned.
600 * @return mixed - By default an array is returned. If return_float is set,
601 * then a float is returned. Array keys: "sec" - seconds since the Unix Epoch
602 * "usec" - microseconds "minuteswest" - minutes west of Greenwich "dsttime" -
603 * type of dst correction
606 <<__Native>>
607 function gettimeofday(bool $return_float = false): mixed;
610 * Identical to the date() function except that the time returned is Greenwich
611 * Mean Time (GMT).
613 * @param string $format - The format of the outputted date string. See the
614 * formatting options for the date() function.
615 * @param int $timestamp - The optional timestamp parameter is an integer Unix
616 * timestamp that defaults to the current local time if a timestamp is not
617 * given. In other words, it defaults to the value of time().
619 * @return mixed - Returns a formatted date string. If a non-numeric value is
620 * used for timestamp, FALSE is returned and an E_WARNING level error is
621 * emitted.
624 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
625 function gmdate(string $format, int $timestamp = -1): mixed;
628 * Identical to mktime() except the passed parameters represents a GMT date.
629 * gmmktime() internally uses mktime() so only times valid in derived local
630 * time can be used. Like mktime(), arguments may be left out in order from
631 * right to left, with any omitted arguments being set to the current
632 * corresponding GMT value.
634 * @return mixed - Returns a integer Unix timestamp.
637 <<__Native>>
638 function gmmktime(int $hour = PHP_INT_MAX,
639 int $minute = PHP_INT_MAX,
640 int $second = PHP_INT_MAX,
641 int $month = PHP_INT_MAX,
642 int $day = PHP_INT_MAX,
643 int $year = PHP_INT_MAX): mixed;
646 * Behaves the same as strftime() except that the time returned is Greenwich
647 * Mean Time (GMT). For example, when run in Eastern Standard Time (GMT
648 * -0500), the first line below prints "Dec 31 1998 20:00:00", while the
649 * second prints "Jan 01 1999 01:00:00".
651 * @param string $format - See description in strftime().
652 * @param int $timestamp - The optional timestamp parameter is an integer Unix
653 * timestamp that defaults to the current local time if a timestamp is not
654 * given. In other words, it defaults to the value of time().
656 * @return string - Returns a string formatted according to the given format
657 * string using the given timestamp or the current local time if no timestamp
658 * is given. Month and weekday names and other language dependent strings
659 * respect the current locale set with setlocale().
662 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
663 function gmstrftime(string $format, int $timestamp = -1): mixed;
666 * Returns a number formatted according to the given format string using the
667 * given integer timestamp or the current local time if no timestamp is given.
668 * In other words, timestamp is optional and defaults to the value of time().
669 * Unlike the function date(), idate() accepts just one char in the format
670 * parameter.
672 * @param string $format - The following characters are recognized in the
673 * format parameter string format character Description B Swatch Beat/Internet
674 * Time d Day of the month h Hour (12 hour format) H Hour (24 hour format) i
675 * Minutes I (uppercase i) returns 1 if DST is activated, 0 otherwise L
676 * (uppercase l) returns 1 for leap year, 0 otherwise m Month number s Seconds
677 * t Days in current month U Seconds since the Unix Epoch - January 1 1970
678 * 00:00:00 UTC - this is the same as time() w Day of the week (0 on Sunday) W
679 * ISO-8601 week number of year, weeks starting on Monday y Year (1 or 2
680 * digits - check note below) Y Year (4 digits) z Day of the year Z Timezone
681 * offset in seconds
682 * @param int $timestamp - The optional timestamp parameter is an integer Unix
683 * timestamp that defaults to the current local time if a timestamp is not
684 * given. In other words, it defaults to the value of time().
686 * @return mixed - Returns an integer. As idate() always returns an integer
687 * and as they can't start with a "0", idate() may return fewer digits than
688 * you would expect. See the example below.
691 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
692 function idate(string $format, int $timestamp = -1): mixed;
695 * The localtime() function returns an array identical to that of the
696 * structure returned by the C function call.
698 * @param int $timestamp - The optional timestamp parameter is an integer Unix
699 * timestamp that defaults to the current local time if a timestamp is not
700 * given. In other words, it defaults to the value of time().
701 * @param bool $is_associative - If set to FALSE or not supplied then the
702 * array is returned as a regular, numerically indexed array. If the argument
703 * is set to TRUE then localtime() returns an associative array containing all
704 * the different elements of the structure returned by the C function call to
705 * localtime. The names of the different keys of the associative array are as
706 * follows: "tm_sec" - seconds "tm_min" - minutes "tm_hour" - hour "tm_mday"
707 * - day of the month Months are from 0 (Jan) to 11 (Dec) and days of the week
708 * are from 0 (Sun) to 6 (Sat). "tm_mon" - month of the year, starting with 0
709 * for January "tm_year" - Years since 1900 "tm_wday" - Day of the week
710 * "tm_yday" - Day of the year "tm_isdst" - Is daylight savings time in effect
712 * @return array
715 <<__Native("NumArgs")>>
716 function localtime(int $timestamp = -1,
717 bool $is_associative = false): array;
720 * microtime() returns the current Unix timestamp with microseconds. This
721 * function is only available on operating systems that support the
722 * gettimeofday() system call.
724 * @param bool $get_as_float - When called without the optional argument, this
725 * function returns the string "msec sec" where sec is the current time
726 * measured in the number of seconds since the Unix Epoch (0:00:00 January 1,
727 * 1970 GMT), and msec is the microseconds part. Both portions of the string
728 * are returned in units of seconds. If the optional get_as_float is set to
729 * TRUE then a float (in seconds) is returned.
731 * @return mixed
734 <<__Native>>
735 function microtime(bool $get_as_float = false): mixed;
738 * Returns the Unix timestamp corresponding to the arguments given. This
739 * timestamp is a long integer containing the number of seconds between the
740 * Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified. Arguments
741 * may be left out in order from right to left; any arguments thus omitted
742 * will be set to the current value according to the local date and time.
744 * @param int $hour - The number of the hour.
745 * @param int $minute - The number of the minute.
746 * @param int $second - The number of seconds past the minute.
747 * @param int $month - The number of the month.
748 * @param int $day - The number of the day.
749 * @param int $year - The number of the year, may be a two or four digit
750 * value, with values between 0-69 mapping to 2000-2069 and 70-100 to
751 * 1970-2000. On systems where time_t is a 32bit signed integer, as most
752 * common today, the valid range for year is somewhere between 1901 and 2038.
753 * However, before PHP 5.1.0 this range was limited from 1970 to 2038 on some
754 * systems (e.g. Windows).
756 * @return mixed - mktime() returns the Unix timestamp of the arguments given.
757 * If the arguments are invalid, the function returns FALSE (before PHP 5.1 it
758 * returned -1).
761 <<__Native>>
762 function mktime(int $hour = PHP_INT_MAX,
763 int $minute = PHP_INT_MAX,
764 int $second = PHP_INT_MAX,
765 int $month = PHP_INT_MAX,
766 int $day = PHP_INT_MAX,
767 int $year = PHP_INT_MAX): mixed;
770 * Format the time and/or date according to locale settings. Month and weekday
771 * names and other language-dependent strings respect the current locale set
772 * with setlocale(). Not all conversion specifiers may be supported by your C
773 * library, in which case they will not be supported by PHP's strftime().
774 * Additionally, not all platforms support negative timestamps, so your date
775 * range may be limited to no earlier than the Unix epoch. This means that %e,
776 * %T, %R and, %D (and possibly others) - as well as dates prior to Jan 1,
777 * 1970 - will not work on Windows, some Linux distributions, and a few other
778 * operating systems. For Windows systems, a complete overview of supported
779 * conversion specifiers can be found at MSDN.
781 * @return mixed - Returns a string formatted according format using the given
782 * timestamp or the current local time if no timestamp is given. Month and
783 * weekday names and other language-dependent strings respect the current
784 * locale set with setlocale().
787 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
788 function strftime(string $format, int $timestamp = -1): mixed;
791 * strptime() returns an array with the date parsed, or FALSE on error. Month
792 * and weekday names and other language dependent strings respect the current
793 * locale set with setlocale() (LC_TIME).
795 * @param string $date - The string to parse (e.g. returned from strftime()).
796 * @param string $format - The format used in date (e.g. the same as used in
797 * strftime()). Note that some of the format options available to strftime()
798 * may not have any effect within strptime(); the exact subset that are
799 * supported will vary based on the operating system and C library in use.
800 * For more information about the format options, read the strftime() page.
802 * @return mixed - Returns an array or FALSE on failure. The following
803 * parameters are returned in the array parameters Description "tm_sec"
804 * Seconds after the minute (0-61) "tm_min" Minutes after the hour (0-59)
805 * "tm_hour" Hour since midnight (0-23) "tm_mday" Day of the month (1-31)
806 * "tm_mon" Months since January (0-11) "tm_year" Years since 1900 "tm_wday"
807 * Days since Sunday (0-6) "tm_yday" Days since January 1 (0-365) "unparsed"
808 * the date part which was not recognized using the specified format
811 <<__Native>>
812 function strptime(string $date, string $format): mixed;
815 * @param string $input - Date and Time Formats.
816 * @param int $timestamp - The timestamp which is used as a base for the
817 * calculation of relative dates.
819 * @return mixed - Returns a timestamp on success, FALSE otherwise. Previous
820 * to PHP 5.1.0, this function would return -1 on failure.
823 <<__ParamCoerceModeFalse, __Native("NumArgs")>>
824 function strtotime(string $input, int $timestamp = -1): mixed;
827 * Returns the current time measured in the number of seconds since the Unix
828 * Epoch (January 1 1970 00:00:00 GMT).
831 <<__Native>>
832 function time(): int;
834 function timezone_abbreviations_list(): array {
835 return DateTimeZone::listAbbreviations();
839 * @param int $what - One of DateTimeZone class constants.
840 * @param string $country - The timestamp which is used as a base for the
841 * calculation of relative dates.
843 * @return mixed
846 function timezone_identifiers_list(int $what = 2047,
847 string $country = ""): mixed {
848 return DateTimeZone::listIdentifiers($what, $country);
851 function timezone_location_get(DateTimeZone $timezone): darray {
852 return $timezone->getLocation();
856 * @param string $abbr - Time zone abbreviation.
857 * @param int $gmtoffset - Offset from GMT in seconds. Defaults to -1 which
858 * means that first found time zone corresponding to abbr is returned.
859 * Otherwise exact offset is searched and only if not found then the first
860 * time zone with any offset is returned.
861 * @param bool $isdst - Daylight saving time indicator. Defaults to -1, which
862 * means that whether the time zone has daylight saving or not is not taken
863 * into consideration when searching. If this is set to 1, then the gmtOffset
864 * is assumed to be an offset with daylight saving in effect; if 0, then
865 * gmtOffset is assumed to be an offset without daylight saving in effect. If
866 * abbr doesn't exist then the time zone is searched solely by the gmtOffset
867 * and isdst.
869 * @return mixed - Returns time zone name on success or FALSE on failure.
872 <<__ParamCoerceModeFalse, __Native>>
873 function timezone_name_from_abbr(string $abbr,
874 int $gmtoffset = -1,
875 int $isdst = 1): mixed;
877 function timezone_name_get(DateTimeZone $timezone): string {
878 return $timezone->getName();
881 <<__ParamCoerceModeFalse>>
882 function timezone_open(string $timezone): mixed {
883 try {
884 return new DateTimeZone($timezone);
886 catch (Exception $e) {
887 $msg = str_replace("DateTimeZone::__construct", "timezone_open",
888 $e->getMessage());
889 trigger_error($msg, E_WARNING);
890 return false;
894 function timezone_transitions_get(DateTimeZone $timezone,
895 int $timestamp_begin = PHP_INT_MIN,
896 int $timestamp_end = PHP_INT_MAX): mixed {
897 return $timezone->getTransitions($timestamp_begin, $timestamp_end);
900 <<__Native>>
901 function timezone_version_get(): string;