PHP日期和时间函数。 中的 getdate()

首页 / PHP入门教程 / PHP日期和时间函数。 中的 getdate()

getdate() - 语法

array getdate ( [int $timestamp] );

它使用给定的整数时间戳返回根据给定格式字符串格式化的字符串,如果没有给定时间戳,则返回当前时间。换句话说,时间戳是可选的,默认为time()的值。

Sr.No Parameter & Description
1

timestamp(可选)

无涯教程网

这是一个整数Unix时间戳,如果没有给定时间戳,则默认为当前本地时间。换句话说,它默认为time()的值。

getdate() - 返回值

它返回与typestamp相关的信息的关联数组。返回的数组包含十个元素,这些元素具有格式化日期字符串-时所需的相关信息

链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-getdate.html

来源:LearnFk无涯教程网

  • [seconds] - seconds
  • [minutes] - minutes
  • [hours] - hours
  • [mday] - day of the month
  • [wday] - day of the week
  • [year] - year
  • [yday] - day of the year
  • [weekday] - name of the weekday
  • [month] - name of the month

getdate() - 示例

<?php
   $today=getdate();
   print_r($today);
?>

这将产生以下输出-

Array (
   [seconds] => 40
   [minutes] => 58
   [hours]   => 21
   [mday]    => 17
   [wday]    => 2
   [mon]     => 6
   [year]    => 2003
   [yday]    => 167
   [weekday] => Tuesday
   [month]   => June
   [0]       => 1055901520
)

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

软件测试52讲 -〔茹炳晟〕

重学前端 -〔程劭非(winter)〕

Linux内核技术实战课 -〔邵亚方〕

Flink核心技术与实战 -〔张利兵〕

动态规划面试宝典 -〔卢誉声〕

Django快速开发实战 -〔吕召刚〕

如何落地业务建模 -〔徐昊〕

说透低代码 -〔陈旭〕

React Native 新架构实战课 -〔蒋宏伟〕

好记忆不如烂笔头。留下您的足迹吧 :)