ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 日期/时间(核心) - [预定义常量](https://www.php.net/manual/zh/datetime.constants.php) - [范例](https://www.php.net/manual/zh/datetime.examples.php) - [DateTime Arithmetic](https://www.php.net/manual/zh/datetime.examples-arithmetic.php) - [Date/Time 函数](https://www.php.net/manual/zh/ref.datetime.php) - [checkdate](https://www.php.net/manual/zh/function.checkdate.php)— 验证一个格里高里日期 - [date\_add](https://www.php.net/manual/zh/function.date-add.php)— 别名 DateTime::add - [date\_create\_from\_format](https://www.php.net/manual/zh/function.date-create-from-format.php)— 别名 DateTime::createFromFormat - [date\_create\_immutable\_from\_format](https://www.php.net/manual/zh/function.date-create-immutable-from-format.php)— 别名 DateTimeImmutable::createFromFormat - [date\_create\_immutable](https://www.php.net/manual/zh/function.date-create-immutable.php)— 别名 DateTimeImmutable::\_\_construct - [date\_create](https://www.php.net/manual/zh/function.date-create.php)— 别名 DateTime::\_\_construct - [date\_date\_set](https://www.php.net/manual/zh/function.date-date-set.php)— 别名 DateTime::setDate - [date\_default\_timezone\_get](https://www.php.net/manual/zh/function.date-default-timezone-get.php)— 取得一个脚本中所有日期时间函数所使用的默认时区 - [date\_default\_timezone\_set](https://www.php.net/manual/zh/function.date-default-timezone-set.php)— 设定用于一个脚本中所有日期时间函数的默认时区 - [date\_diff](https://www.php.net/manual/zh/function.date-diff.php)— 别名 DateTime::diff - [date\_format](https://www.php.net/manual/zh/function.date-format.php)— 别名 DateTime::format - [date\_get\_last\_errors](https://www.php.net/manual/zh/function.date-get-last-errors.php)— 别名 DateTime::getLastErrors - [date\_interval\_create\_from\_date\_string](https://www.php.net/manual/zh/function.date-interval-create-from-date-string.php)— 别名 DateInterval::createFromDateString - [date\_interval\_format](https://www.php.net/manual/zh/function.date-interval-format.php)— 别名 DateInterval::format - [date\_isodate\_set](https://www.php.net/manual/zh/function.date-isodate-set.php)— 别名 DateTime::setISODate - [date\_modify](https://www.php.net/manual/zh/function.date-modify.php)— 别名 DateTime::modify - [date\_offset\_get](https://www.php.net/manual/zh/function.date-offset-get.php)— 别名 DateTime::getOffset - [date\_parse\_from\_format](https://www.php.net/manual/zh/function.date-parse-from-format.php)— Get info about given date formatted according to the specified format - [date\_parse](https://www.php.net/manual/zh/function.date-parse.php)— Returns associative array with detailed info about given date - [date\_sub](https://www.php.net/manual/zh/function.date-sub.php)— 别名 DateTime::sub - [date\_sun\_info](https://www.php.net/manual/zh/function.date-sun-info.php)— Returns an array with information about sunset/sunrise and twilight begin/end - [date\_sunrise](https://www.php.net/manual/zh/function.date-sunrise.php)— 返回给定的日期与地点的日出时间 - [date\_sunset](https://www.php.net/manual/zh/function.date-sunset.php)— 返回给定的日期与地点的日落时间 - [date\_time\_set](https://www.php.net/manual/zh/function.date-time-set.php)— 别名 DateTime::setTime - [date\_timestamp\_get](https://www.php.net/manual/zh/function.date-timestamp-get.php)— 别名 DateTime::getTimestamp - [date\_timestamp\_set](https://www.php.net/manual/zh/function.date-timestamp-set.php)— 别名 DateTime::setTimestamp - [date\_timezone\_get](https://www.php.net/manual/zh/function.date-timezone-get.php)— 别名 DateTime::getTimezone - [date\_timezone\_set](https://www.php.net/manual/zh/function.date-timezone-set.php)— 别名 DateTime::setTimezone - [date](https://www.php.net/manual/zh/function.date.php)— 格式化一个本地时间/日期 - [getdate](https://www.php.net/manual/zh/function.getdate.php)— 取得日期/时间信息 - [gettimeofday](https://www.php.net/manual/zh/function.gettimeofday.php)— 取得当前时间 - [gmdate](https://www.php.net/manual/zh/function.gmdate.php)— 格式化一个 GMT/UTC 日期/时间 - [gmmktime](https://www.php.net/manual/zh/function.gmmktime.php)— 取得 GMT 日期的 UNIX 时间戳 - [gmstrftime](https://www.php.net/manual/zh/function.gmstrftime.php)— 根据区域设置格式化 GMT/UTC 时间/日期 - [idate](https://www.php.net/manual/zh/function.idate.php)— 将本地时间日期格式化为整数 - [localtime](https://www.php.net/manual/zh/function.localtime.php)— 取得本地时间 - [microtime](https://www.php.net/manual/zh/function.microtime.php)— 返回当前 Unix 时间戳和微秒数 - [mktime](https://www.php.net/manual/zh/function.mktime.php)— 取得一个日期的 Unix 时间戳 - [strftime](https://www.php.net/manual/zh/function.strftime.php)— 根据区域设置格式化本地时间/日期 - [strptime](https://www.php.net/manual/zh/function.strptime.php)— 解析由 strftime 生成的日期/时间 - [strtotime](https://www.php.net/manual/zh/function.strtotime.php)— 将任何字符串的日期时间描述解析为 Unix 时间戳 - [time](https://www.php.net/manual/zh/function.time.php)— 返回当前的 Unix 时间戳 - [timezone\_abbreviations\_list](https://www.php.net/manual/zh/function.timezone-abbreviations-list.php)— 别名 DateTimeZone::listAbbreviations - [timezone\_identifiers\_list](https://www.php.net/manual/zh/function.timezone-identifiers-list.php)— 别名 DateTimeZone::listIdentifiers - [timezone\_location\_get](https://www.php.net/manual/zh/function.timezone-location-get.php)— 别名 DateTimeZone::getLocation - [timezone\_name\_from\_abbr](https://www.php.net/manual/zh/function.timezone-name-from-abbr.php)— Returns the timezone name from abbreviation - [timezone\_name\_get](https://www.php.net/manual/zh/function.timezone-name-get.php)— 别名 DateTimeZone::getName - [timezone\_offset\_get](https://www.php.net/manual/zh/function.timezone-offset-get.php)— 别名 DateTimeZone::getOffset - [timezone\_open](https://www.php.net/manual/zh/function.timezone-open.php)— 别名 DateTimeZone::\_\_construct - [timezone\_transitions\_get](https://www.php.net/manual/zh/function.timezone-transitions-get.php)— 别名 DateTimeZone::getTransitions - [timezone\_version\_get](https://www.php.net/manual/zh/function.timezone-version-get.php)— Gets the version of the timezonedb - - - - - - - [DateTime](https://www.php.net/manual/zh/class.datetime.php)— DateTime 类 - [DateTime::add](https://www.php.net/manual/zh/datetime.add.php)— 给一个 DateTime 对象增加一定量的天,月,年,小时,分钟 以及秒。 - [DateTime::\_\_construct](https://www.php.net/manual/zh/datetime.construct.php)— 返回一个新的 DateTime 对象 - [DateTime::createFromFormat](https://www.php.net/manual/zh/datetime.createfromformat.php)— 根据给定的格式解析日期时间字符串 - [DateTime::createFromImmutable](https://www.php.net/manual/zh/datetime.createfromimmutable.php)— Returns new DateTime object encapsulating the given DateTimeImmutable object - [DateTime::getLastErrors](https://www.php.net/manual/zh/datetime.getlasterrors.php)— 获取警告和错误信息 - [DateTime::modify](https://www.php.net/manual/zh/datetime.modify.php)— 修改日期时间对象的值 - [DateTime::\_\_set\_state](https://www.php.net/manual/zh/datetime.set-state.php)— \_\_set\_state 魔术方法处理函数 - [DateTime::setDate](https://www.php.net/manual/zh/datetime.setdate.php)— 设置 DateTime 对象的日期 - [DateTime::setISODate](https://www.php.net/manual/zh/datetime.setisodate.php)— 设置 ISO 日期 - [DateTime::setTime](https://www.php.net/manual/zh/datetime.settime.php)— 设置 DateTime 对象的时间 - [DateTime::setTimestamp](https://www.php.net/manual/zh/datetime.settimestamp.php)— 以 Unix 时间戳的方式设置 DateTime 对象 - [DateTime::setTimezone](https://www.php.net/manual/zh/datetime.settimezone.php)— 设置 DateTime 对象的时区 - [DateTime::sub](https://www.php.net/manual/zh/datetime.sub.php)— 对一个 DateTime 对象减去一定量的 日、月、年、小时、分钟和秒。 - [DateTimeImmutable](https://www.php.net/manual/zh/class.datetimeimmutable.php)— The DateTimeImmutable class - [DateTimeImmutable::add](https://www.php.net/manual/zh/datetimeimmutable.add.php)— Adds an amount of days, months, years, hours, minutes and seconds - [DateTimeImmutable::\_\_construct](https://www.php.net/manual/zh/datetimeimmutable.construct.php)— Returns new DateTimeImmutable object - [DateTimeImmutable::createFromFormat](https://www.php.net/manual/zh/datetimeimmutable.createfromformat.php)— Parses a time string according to a specified format - [DateTimeImmutable::createFromMutable](https://www.php.net/manual/zh/datetimeimmutable.createfrommutable.php)— Returns new DateTimeImmutable object encapsulating the given DateTime object - [DateTimeImmutable::getLastErrors](https://www.php.net/manual/zh/datetimeimmutable.getlasterrors.php)— Returns the warnings and errors - [DateTimeImmutable::modify](https://www.php.net/manual/zh/datetimeimmutable.modify.php)— Creates a new object with modified timestamp - [DateTimeImmutable::\_\_set\_state](https://www.php.net/manual/zh/datetimeimmutable.set-state.php)— The \_\_set\_state handler - [DateTimeImmutable::setDate](https://www.php.net/manual/zh/datetimeimmutable.setdate.php)— Sets the date - [DateTimeImmutable::setISODate](https://www.php.net/manual/zh/datetimeimmutable.setisodate.php)— Sets the ISO date - [DateTimeImmutable::setTime](https://www.php.net/manual/zh/datetimeimmutable.settime.php)— Sets the time - [DateTimeImmutable::setTimestamp](https://www.php.net/manual/zh/datetimeimmutable.settimestamp.php)— Sets the date and time based on a Unix timestamp - [DateTimeImmutable::setTimezone](https://www.php.net/manual/zh/datetimeimmutable.settimezone.php)— Sets the time zone - [DateTimeImmutable::sub](https://www.php.net/manual/zh/datetimeimmutable.sub.php)— Subtracts an amount of days, months, years, hours, minutes and seconds - [DateTimeInterface](https://www.php.net/manual/zh/class.datetimeinterface.php)— The DateTimeInterface interface - [DateTime::diff](https://www.php.net/manual/zh/datetime.diff.php)— Returns the difference between two DateTime objects - [DateTime::format](https://www.php.net/manual/zh/datetime.format.php)— Returns date formatted according to given format - [DateTime::getOffset](https://www.php.net/manual/zh/datetime.getoffset.php)— Returns the timezone offset - [DateTime::getTimestamp](https://www.php.net/manual/zh/datetime.gettimestamp.php)— Gets the Unix timestamp - [DateTime::getTimezone](https://www.php.net/manual/zh/datetime.gettimezone.php)— Return time zone relative to given DateTime - [DateTime::\_\_wakeup](https://www.php.net/manual/zh/datetime.wakeup.php)— The \_\_wakeup handler - [DateTimeZone](https://www.php.net/manual/zh/class.datetimezone.php)— The DateTimeZone class - [DateTimeZone::\_\_construct](https://www.php.net/manual/zh/datetimezone.construct.php)— 创建新的DateTimeZone对象 - [DateTimeZone::getLocation](https://www.php.net/manual/zh/datetimezone.getlocation.php)— 返回与时区相关的定位信息。 - [DateTimeZone::getName](https://www.php.net/manual/zh/datetimezone.getname.php)— 返回时区名称。 - [DateTimeZone::getOffset](https://www.php.net/manual/zh/datetimezone.getoffset.php)— 返回相对于 GMT 的时差。 - [DateTimeZone::getTransitions](https://www.php.net/manual/zh/datetimezone.gettransitions.php)— Returns all transitions for the timezone - [DateTimeZone::listAbbreviations](https://www.php.net/manual/zh/datetimezone.listabbreviations.php)— 返回一个包含 dst (夏令时),时差和时区信息的关联数组。 - [DateTimeZone::listIdentifiers](https://www.php.net/manual/zh/datetimezone.listidentifiers.php)— 返回一个包含了所有时区标示符的索引数组。 - [DateInterval](https://www.php.net/manual/zh/class.dateinterval.php)— DateInterval 类 - [DateInterval::\_\_construct](https://www.php.net/manual/zh/dateinterval.construct.php)— Creates a new DateInterval object - [DateInterval::createFromDateString](https://www.php.net/manual/zh/dateinterval.createfromdatestring.php)— Sets up a DateInterval from the relative parts of the string - [DateInterval::format](https://www.php.net/manual/zh/dateinterval.format.php)— Formats the interval - [DatePeriod](https://www.php.net/manual/zh/class.dateperiod.php)— DatePeriod 类 - [DatePeriod::\_\_construct](https://www.php.net/manual/zh/dateperiod.construct.php)— Creates a new DatePeriod object - [DatePeriod::getDateInterval](https://www.php.net/manual/zh/dateperiod.getdateinterval.php)— Gets the interval - [DatePeriod::getEndDate](https://www.php.net/manual/zh/dateperiod.getenddate.php)— Gets the end date - [DatePeriod::getRecurrences](https://www.php.net/manual/zh/dateperiod.getrecurrences.php)— Gets the number of recurrences - [DatePeriod::getStartDate](https://www.php.net/manual/zh/dateperiod.getstartdate.php)— Gets the start date - [Supported Date and Time Formats](https://www.php.net/manual/zh/datetime.formats.php) - [Time Formats](https://www.php.net/manual/zh/datetime.formats.time.php) - [Date Formats](https://www.php.net/manual/zh/datetime.formats.date.php) - [Compound Formats](https://www.php.net/manual/zh/datetime.formats.compound.php) - [Relative Formats](https://www.php.net/manual/zh/datetime.formats.relative.php) - [所支持的时区列表](https://www.php.net/manual/zh/timezones.php) - [非洲](https://www.php.net/manual/zh/timezones.africa.php) - [美洲](https://www.php.net/manual/zh/timezones.america.php) - [南极洲](https://www.php.net/manual/zh/timezones.antarctica.php) - [北极](https://www.php.net/manual/zh/timezones.arctic.php) - [亚洲](https://www.php.net/manual/zh/timezones.asia.php) - [大西洋](https://www.php.net/manual/zh/timezones.atlantic.php) - [澳洲](https://www.php.net/manual/zh/timezones.australia.php) - [欧洲](https://www.php.net/manual/zh/timezones.europe.php) - [印度](https://www.php.net/manual/zh/timezones.indian.php) - [太平洋地区](https://www.php.net/manual/zh/timezones.pacific.php) - [其他](https://www.php.net/manual/zh/timezones.others.php)