1 <?hh // decl /* -*- php -*- */
3 * Copyright (c) 2014, Facebook, Inc.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
11 const DATE_ATOM = "Y-m-d\\TH:i:sP";
12 const DATE_COOKIE = "l, d-M-y H:i:s T";
13 const DATE_ISO8601 = "Y-m-d\\TH:i:sO";
14 const DATE_RFC1036 = "D, d M y H:i:s O";
15 const DATE_RFC1123 = "D, d M Y H:i:s O";
16 const DATE_RFC2822 = "D, d M Y H:i:s O";
17 const DATE_RFC3339 = "Y-m-d\\TH:i:sP";
18 const DATE_RFC822 = "D, d M y H:i:s O";
19 const DATE_RFC850 = "l, d-M-y H:i:s T";
20 const DATE_RSS = "D, d M Y H:i:s O";
21 const DATE_W3C = "Y-m-d\\TH:i:sP";
32 function checkdate($month, $day, $year) { }
34 function date_add($datetime, $interval) { }
36 function date_create_from_format($format, $time, $timezone = null) { }
38 function date_create($time = null, $timezone = null) { }
40 function date_date_set($object, $year, $month, $day) { }
42 function date_default_timezone_get() { }
44 function date_default_timezone_set($name) { }
46 function date_diff($datetime, $datetime2, $absolute = false) { }
48 function date_format($object, $format) { }
50 function date_get_last_errors() { }
52 function date_interval_create_from_date_string($time) { }
54 function date_interval_format($interval, $format_spec) { }
56 function date_isodate_set($object, $year, $week, $day = 1) { }
58 function date_modify($object, $modify) { }
60 function date_offset_get($object) { }
62 function date_parse($date) { }
64 function date_sub($datetime, $interval) { }
66 function date_sun_info($ts, $latitude, $longitude) { }
68 function date_sunrise($timestamp, $format = 0, $latitude = 0.0, $longitude = 0.0, $zenith = 0.0, $gmt_offset = 99999.0) { }
70 function date_sunset($timestamp, $format = 0, $latitude = 0.0, $longitude = 0.0, $zenith = 0.0, $gmt_offset = 99999.0) { }
72 function date_time_set($object, $hour, $minute, $second = 0) { }
74 function date_timestamp_get($datetime) { }
76 function date_timestamp_set($datetime, $timestamp) { }
78 function date_timezone_get($object) { }
80 function date_timezone_set($object, $timezone) { }
82 function date($format, $timestamp = null)/*: string*/ { }
84 function getdate($timestamp = null) { }
86 function gettimeofday($return_float = false) { }
88 function gmdate($format, $timestamp = null) { }
90 function gmmktime($hour = PHP_INT_MAX, $minute = PHP_INT_MAX, $second = PHP_INT_MAX, $month = PHP_INT_MAX, $day = PHP_INT_MAX, $year = PHP_INT_MAX) { }
92 function gmstrftime($format, $timestamp = null) { }
94 function idate($format, $timestamp = null) { }
96 function localtime($timestamp = null, $is_associative = false) { }
98 function microtime($get_as_float = false) { }
100 function mktime($hour = PHP_INT_MAX, $minute = PHP_INT_MAX, $second = PHP_INT_MAX, $month = PHP_INT_MAX, $day = PHP_INT_MAX, $year = PHP_INT_MAX) { }
102 function strftime($format, $timestamp = null) { }
104 function strptime($date, $format) { }
106 function strtotime($input, $timestamp = null) { }
108 function time(): int { }
110 function timezone_abbreviations_list() { }
112 function timezone_identifiers_list(int $what = 2047, string $country = '') { }
114 function timezone_location_get($timezone) { }
116 function timezone_name_from_abbr($abbr, $gmtoffset = -1, $isdst = true) { }
118 function timezone_name_get($object) { }
120 function timezone_offset_get($object, $dt) { }
122 function timezone_open($timezone) { }
124 function timezone_transitions_get(DateTimeZone $object,
125 int $timestamp_begin = PHP_INT_MIN,
126 int $timestamp_end = PHP_INT_MAX) { }
128 function timezone_version_get() { }
130 interface DateTimeInterface {
131 public function diff(DateTimeInterface $datetime2, bool $absolute = false);
132 public function format(string $format);
133 public function getOffset();
134 public function getTimestamp();
135 public function getTimezone();
138 class DateTime implements DateTimeInterface {
150 public function __construct(mixed $time = 'now', ?DateTimeZone $timezone = null);
151 public function add(DateInterval $interval);
152 public function modify(string $modify);
153 public function getOffset();
154 public function getTimestamp();
155 public function getTimezone();
156 public function setDate(int $year, int $month, int $day);
157 public function setISODate(int $year, int $week, int $day = 1);
158 public function setTime(int $hour, int $minute, int $second = 0);
159 public function setTimestamp(int $unixtimestamp);
160 public function setTimezone(DateTimeZone $timezone);
161 public function sub(DateInterval $interval) { }
162 public function diff(DateTimeInterface $datetime2, bool $absolute = false);
163 public function format(string $format);
164 public static function createFromFormat(
167 ?DateTimeZone $timezone = null,
169 public static function getLastErrors(): array;
172 class DateTimeImmutable implements DateTimeInterface {
173 private DateTime $data;
175 public function __construct(mixed $time = 'now', ?DateTimeZone $timezone = null);
176 public function add(DateInterval $interval);
177 public function modify(string $modify);
178 public function getOffset();
179 public function getTimestamp();
180 public function getTimezone();
181 public function setDate(int $year, int $month, int $day);
182 public function setISODate(int $year, int $week, int $day = 1);
183 public function setTime(int $hour, int $minute, int $second = 0);
184 public function setTimestamp(int $unixtimestamp);
185 public function setTimezone(DateTimeZone $timezone);
186 public function sub(DateInterval $interval);
187 public function diff(DateTimeInterface $datetime2, bool $absolute = false);
188 public function format(string $format);
189 public static function createFromFormat(
192 ?DateTimeZone $timezone = null,
194 public static function createFromMutable(DateTime $datetime);
195 public static function getLastErrors(): array;
196 public function __clone();
202 const ANTARCTICA = 0;
212 const ALL_WITH_BC = 0;
213 const PER_COUNTRY = 0;
214 public function __construct(string $timezone);
215 public function getLocation(): array { }
216 public function getName(): string { }
217 public function getOffset(DateTime $datetime);
218 public function getTransitions(int $timestamp_begin = PHP_INT_MIN,
219 int $timestamp_end = PHP_INT_MAX);
220 static public function listAbbreviations();
221 static public function listIdentifiers(int $what = 2047, string $country = '');
234 public function __construct(string $interval_spec);
235 public function __get($member);
236 public function __set($member, $value);
237 static public function createFromDateString(string $time);
238 public function format(string $format);
241 class DatePeriod implements Iterator<DateTime> {
242 const EXCLUDE_START_DATE = 1;
244 public function __construct(
245 /* DateTimeInterface */ $start, // date string converts
246 DateInterval $interval,
247 /* ?DateTimeInterface */ $end = null, // date string converts
250 public function current(): DateTime;
251 public function rewind(): void;
252 public function key();
253 public function next();
254 public function valid(): bool;
255 public function getStartDate(): DateTime;
256 public function getEndDate(): DateTime;
257 public function getDateInterval(): DateInterval;