首页  >  文章  >  后端开发  >  PHP 日期时间函数

PHP 日期时间函数

WBOY
WBOY原创
2024-08-29 12:51:51500浏览

PHP 日期时间函数是内置函数,可以简化日期数据类型的工作,有助于将日期或时间转换为一种人类可读的格式,以便显示要显示的文章的数据发布,时间函数将有助于返回时间戳(当前值时间与格林威治标准时间之间的数值/以秒为单位的值(GMT 值截至 1970 年,1st一月 00:00:00)) UNIX 格式。

开始您的免费软件开发课程

网络开发、编程语言、软件测试及其他

PHP 日期时间函数的类型

PHP 的日期或时间函数是 PHP 核心编程语言的一部分。因此,您不需要任何扩展即可使用所有日期/时间函数。下面简要查看不同类型的 PHP 日期/时间函数:

PHP 编程语言的日期时间函数列表:

1。 checkdate(): 此函数将让我们验证公历数据。

2。 date_add(): 此函数可以在日期中添加日、月、年、小时、分钟和秒。

3。 date_create_from_format(): 上面的日期时间函数将返回一个根据特定格式格式化的新日期时间对象。

4。 date_create(): date_create() 函数将返回一个新的 DateTime 对象

5。 date_date_set(): date_date_set() 函数将帮助您在 PHP 编程语言中设置新日期。

6。 date_default_timezone_get(): date_default_timezone_get() 函数将有助于返回所有时间/日期函数使用的默认时区。

7。 date_default_timezone_set(): date_default_timezone_set() 函数将帮助您设置所有日期时间函数都可以使用的默认时区。

8。 date_diff():date_diff() 函数将返回 PHP 编程语言中两个日期之间的差异。

9。 date_format():date_format() 函数将帮助返回根据 PHP 编程语言中指定的格式格式化的日期。

10。 date_get_last_errors():date_get_last_errors() 函数有助于返回 PHP 编程语言中日期字符串中的错误/警告。

11。 date_interval_create_from_date_string():date_interval_create_from_date_string() 函数将帮助设置日期间隔,该日期间隔来自 PHP 编程语言中字符串的相关部分。

12。 date_interval_format():date_interval_format() 函数将有助于在 PHP 编程语言中格式化间隔。

13。 date_isodate_set(): date_isodate_set() 函数将有助于在 PHP 编程语言中设置 ISO 日期。

14。 date_modify(): date_modify() 函数将帮助您修改 PHP 编程语言中的时间戳。

15。 date_offset_get():date_offset_get() 函数将有助于返回 PHP 编程语言中的时区偏移量。

16。 date_parse_from_format():date_parse_from_format() 函数将帮助根据 PHP 编程语言中指定的格式返回关联数组,其中包含有关特定日期的一些详细信息。

17。 date_parse(): date_parse() 函数将帮助您返回关联数组,其中包含有关 PHP 编程语言中特定/指定日期的详细信息。

18。 date_sub(): date_sub() 函数有助于在 PHP 编程语言中减去日期、月份、年份、小时、分钟和秒。

19。 date_sun_info(): date_sun_info() 函数将帮助您返回一个或多个数组,其中包含有关日出/日落以及黄昏开始/结束的信息,这些信息适用于指定日期以及指定位置PHP 编程语言。

20。 date_sunrise(): date_sunrise() 函数将帮助您以 PHP 编程语言返回指定地点的日出时间和指定日期。

21。 date_sunset(): date_sunset() 函数将有助于以 PHP 编程语言返回指定位置和指定日期/日期的日落时间。

22。 date_time_set(): date_time_set() 函数将帮助您用 PHP 编程语言设置时间。

23。 date_timestamp_get(): date_timestamp_get() 函数将有助于在 PHP 编程语言中返回 Unix 的时间戳。

24。 date_timestamp_set(): date_timestamp_set() 函数将帮助我们在 PHP 编程语言中根据 Unix 时间戳设置时间和日期。

25。 date_timezone_get(): date_timezone_get() 函数将帮助返回 PHP 编程语言中 DateTime 对象给出的时区。

26。 date(): date() 函数将有助于在 PHP 编程语言中格式化本地时间和日期。

27。 getdate(): getdate() 函数将帮助返回时间/日期信息/时间戳或当前本地时间/日期的信息。

28。 gettimeofday():gettimeofday() 函数将有助于返回当前时间。

29。 gmdate():gmdate() 函数将有助于返回格式化的 GMT/UTC 时间和日期。

30。 gmmktime(): gmmktime() 函数将通过返回 UNIX 时间来帮助获取 GMT 日期

31。 gmstrftime(): gmstrftime() 函数将帮助根据区域设置格式化 UTC/GMT 时间和时间。

32。 idate():idate() 函数会将本地日期/时间格式化为整数。

33。 localtime(): localtime() 函数将帮助我们返回本地系统时间。

34。 microtime():microtime() 函数将有助于返回当前的 Unix 时间戳/微秒时间戳。

35。 mktime():mktime() 函数将通过返回日期的 Unix 时间戳来提供帮助。

36。 strftime():strftime() 函数根据本地设置格式化本地日期和/或本地时间。

37。 strptime():strptime() 函数将帮助解析 strftime() 生成的日期/时间。

38。 strtotime():strtotime() 函数将帮助将英文文本日期时间解析为 Unix 时间戳。

39。 time(): time() 函数将有助于以 Unix 时间戳形式返回当前时间。

40。 timezone_abbreviations_list(): timezone_abbreviations_list() 函数将帮助返回包含夏令时、偏移量以及时区名称的关联数组。

41。 timezone_identifiers_list():timezone_identifiers_list() 函数将有助于返回包含所有时区标识符的索引数组。

42。 timezone_locaiton_get(): timezone_location_get() 函数将帮助返回指定时区的位置信息/信息。

43。 timezone_name_form_abbr(): timezone_name_form_abbr() 函数将有助于从缩写返回时区名称。

44。 timezone_name_get(): timezone_name_get() 函数将有助于返回时区的名称。

45。 timezone_offset_get(): timezone_offset_get() 函数将帮助返回时区相对于格林威治标准时间 (GMT) 的偏移量。

46。 timezone_open(): timezone_open() 将有助于创建新的 DateTIme 区域对象。

47。 timezone_transitions_get(): timezone_transitions_get() 函数将帮助返回该时区的所有交易。

48。 timezone_version_get(): timezone_version_get() 函数将帮助我们返回时区版本。

以上是PHP 日期时间函数的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
上一篇:PHP async下一篇:PHP timezone