略微加速
PHP官方手册 - 互联网笔记
首页
IT
PHP手册
Elasticsearch
SVN手册
互联网
博客
登陆
注册
PHP - Manual: 日期/时间
2025-02-26
简介 »
« unixtojd
PHP 手册
函数参考
日期与时间相关扩展
日期和时间
简介
安装/配置
安装
运行时配置
预定义常量
示例
日期/时间算法
DateTime
— DateTime 类
DateTime::add
— 修改 DateTime 对象,增加天、月、年、小时、分钟以及秒的数量。
DateTime::__construct
— 返回新的 DateTime 对象
DateTime::createFromFormat
— 根据指定格式解析时间字符串
DateTime::createFromImmutable
— Returns new DateTime instance encapsulating the given DateTimeImmutable object
DateTime::createFromInterface
— Returns new DateTime object encapsulating the given DateTimeInterface object
DateTime::getLastErrors
— 别名 DateTimeImmutable::getLastErrors
DateTime::modify
— 修改日期时间对象的值
DateTime::__set_state
— __set_state 处理程序
DateTime::setDate
— 设置日期
DateTime::setISODate
— 设置 ISO 日期
DateTime::setTime
— 设置时间
DateTime::setTimestamp
— 以 Unix 时间戳的方式设置日期和时间
DateTime::setTimezone
— 设置 DateTime 对象的时区
DateTime::sub
— 对 DateTime 对象减去一定量的日、月、年、小时、分钟和秒。
DateTimeImmutable
— The DateTimeImmutable class
DateTimeImmutable::add
— Returns a new object, with added amount of days, months, years, hours, minutes and seconds
DateTimeImmutable::__construct
— Returns new DateTimeImmutable object
DateTimeImmutable::createFromFormat
— Parses a time string according to a specified format
DateTimeImmutable::createFromInterface
— Returns new DateTimeImmutable object encapsulating the given DateTimeInterface object
DateTimeImmutable::createFromMutable
— Returns new DateTimeImmutable instance encapsulating the given DateTime object
DateTimeImmutable::getLastErrors
— Returns the warnings and errors
DateTimeImmutable::modify
— Creates a new object with modified timestamp
DateTimeImmutable::__set_state
— The __set_state handler
DateTimeImmutable::setDate
— Sets the date
DateTimeImmutable::setISODate
— Sets the ISO date
DateTimeImmutable::setTime
— Sets the time
DateTimeImmutable::setTimestamp
— Sets the date and time based on a Unix timestamp
DateTimeImmutable::setTimezone
— Sets the time zone
DateTimeImmutable::sub
— Subtracts an amount of days, months, years, hours, minutes and seconds
DateTimeInterface
— The DateTimeInterface interface
DateTimeInterface::diff
— 返回两个 DateTime 之间的差值
DateTimeInterface::format
— 按照指定格式返回格式化后的日期
DateTimeInterface::getOffset
— 返回时差
DateTimeInterface::getTimestamp
— 获取 Unix 时间戳
DateTimeInterface::getTimezone
— 返回相对于指定 DateTime 的时区
DateTime::__wakeup
— The __wakeup handler
DateTimeZone
— DateTimeZone 类
DateTimeZone::__construct
— 创建新的DateTimeZone对象
DateTimeZone::getLocation
— 返回与时区相关的定位信息
DateTimeZone::getName
— 返回时区名称
DateTimeZone::getOffset
— 返回相对于 GMT 的时差
DateTimeZone::getTransitions
— Returns all transitions for the timezone
DateTimeZone::listAbbreviations
— 返回一个包含 dst (夏令时),时差和时区信息的关联数组。
DateTimeZone::listIdentifiers
— 返回包含了所有时区标识符的数字索引数组
DateInterval
— DateInterval 类
DateInterval::__construct
— Creates a new DateInterval object
DateInterval::createFromDateString
— Sets up a DateInterval from the relative parts of the string
DateInterval::format
— Formats the interval
DatePeriod
— DatePeriod 类
DatePeriod::__construct
— Creates a new DatePeriod object
DatePeriod::createFromISO8601String
— Creates a new DatePeriod object from an ISO8601 string
DatePeriod::getDateInterval
— Gets the interval
DatePeriod::getEndDate
— Gets the end date
DatePeriod::getRecurrences
— Gets the number of recurrences
DatePeriod::getStartDate
— Gets the start date
Date/Time 函数
checkdate
— 验证一个格里高里日期
date
— 格式化 Unix 时间戳
date_add
— 别名 DateTime::add
date_create
— create a new DateTime object
date_create_from_format
— 别名 DateTime::createFromFormat
date_create_immutable
— create a new DateTimeImmutable object
date_create_immutable_from_format
— 别名 DateTimeImmutable::createFromFormat
date_date_set
— 别名 DateTime::setDate
date_default_timezone_get
— 取得脚本中所有日期/时间函数所使用的默认时区
date_default_timezone_set
— 设置脚本中所有日期/时间函数使用的默认时区
date_diff
— 别名 DateTime::diff
date_format
— 别名 DateTime::format
date_get_last_errors
— 别名 DateTimeImmutable::getLastErrors
date_interval_create_from_date_string
— 别名 DateInterval::createFromDateString
date_interval_format
— 别名 DateInterval::format
date_isodate_set
— 别名 DateTime::setISODate
date_modify
— 别名 DateTime::modify
date_offset_get
— 别名 DateTime::getOffset
date_parse
— 返回指定日期/时间的详细信息的关联数组
date_parse_from_format
— Get info about given date formatted according to the specified format
date_sub
— 别名 DateTime::sub
date_sun_info
— Returns an array with information about sunset/sunrise and twilight begin/end
date_sunrise
— 返回给定的日期与地点的日出时间
date_sunset
— 返回给定的日期与地点的日落时间
date_time_set
— 别名 DateTime::setTime
date_timestamp_get
— 别名 DateTime::getTimestamp
date_timestamp_set
— 别名 DateTime::setTimestamp
date_timezone_get
— 别名 DateTime::getTimezone
date_timezone_set
— 别名 DateTime::setTimezone
getdate
— 获取日期/时间信息
gettimeofday
— 取得当前时间
gmdate
— 格式化 GMT/UTC 日期/时间
gmmktime
— 取得 GMT 日期的 UNIX 时间戳
gmstrftime
— 根据区域设置格式化 GMT/UTC 时间/日期
idate
— 将本地日期/时间格式化为整数
localtime
— 取得本地时间
microtime
— 返回当前 Unix 时间戳和微秒数
mktime
— 取得一个日期的 Unix 时间戳
strftime
— 根据区域设置格式化本地时间/日期
strptime
— 解析由 strftime 生成的日期/时间
strtotime
— 将任何英文文本日期时间描述解析为 Unix 时间戳
time
— 返回当前的 Unix 时间戳
timezone_abbreviations_list
— 别名 DateTimeZone::listAbbreviations
timezone_identifiers_list
— 别名 DateTimeZone::listIdentifiers
timezone_location_get
— 别名 DateTimeZone::getLocation
timezone_name_from_abbr
— Returns a timezone name by guessing from abbreviation and UTC offset
timezone_name_get
— 别名 DateTimeZone::getName
timezone_offset_get
— 别名 DateTimeZone::getOffset
timezone_open
— 别名 DateTimeZone::__construct
timezone_transitions_get
— 别名 DateTimeZone::getTransitions
timezone_version_get
— 获取 timezonedb 版本
日期/时间 Error 和 Exception
Supported Date and Time Formats
所支持的时区列表
非洲
美洲
南极洲
北极
亚洲
大西洋
澳洲
欧洲
印度
太平洋地区
其他
DateError
— The DateError class
DateObjectError
— The DateObjectError class
DateRangeError
— The DateRangeError class
DateException
— The DateException class
DateInvalidOperationException
— The DateInvalidOperationException class
DateInvalidTimeZoneException
— The DateInvalidTimeZoneException class
DateMalformedIntervalStringException
— The DateMalformedIntervalStringException class
DateMalformedPeriodStringException
— The DateMalformedPeriodStringException class
DateMalformedStringException
— The DateMalformedStringException class
发现了问题?
了解如何改进此页面
•
提交拉取请求
•
报告一个错误
+
添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
官方地址:
https://www.php.net/manual/en/book.datetime.php
有任何技术问题请点击这里
网站运营推广招聘
IT
PHP
编程语言
开发编程
Linux
科技
Elasticsearch
HTML/CSS/XML
面试
数据库
网络
JAVA
NoSQL
C/C++
Golang
Git
算法
操作系统
正则表达式
Redis
互联网
MySql
JavaScript
运维
软件
国际
架构设计
Mac OS
TCP/IP
Excel
Windows
Vim
Socket
Oracle
VR
MongoDB
运营
Python
MemCache
商业
硬件
电子
娱乐
设计
nginx
摄影
游戏
WordPress
HTTP
团建
数码电器
Docker
广告
广告
docker-compose启动nginx与php-fpm
composer install参数
php7 安装fileinfo扩展
preg_split — 通过一个正则表达式分隔字符串
php位值,解决 PHP 中 usort 在值相同时改变原始位置的问题
[PHP] inet_pton/inet_ntop IP地址转换函数
Composer的Packagist资源
[鸟哥]PHP_INT_MIN 和 -9223372036854775808
PHP 8.1
PHP json解析(json_decode)页面工具
opcache预加载
php $_SERVER中的SERVER_NAME 和HTTP_HOST的区别
mysql面试题
composer基本用法
Packagist / Composer 中国全量镜像
adodb手册
支持php7的性能采集扩展
PHP7 mcrypt替代方案
纯php实现DES以及TripleDES加密算法
两千行PHP学习笔记
联系我们
半月雨文化
可降解耗材网
蓝云环保
78免费小説
上海网站seo优化
工程造价
币安app官网下载
币安app官网下载
coinbase
成都贷款
seo查询
北京半月雨文化科技有限公司
.版权所有
京ICP备12026184号-3