getdate函数

PHP getdate()函数 (PHP getdate() function)

getdate() function is used to get the local date/time (or it is also used to get the date/time based on the given timestamp.

getdate()函数用于获取本地日期/时间(或也用于根据给定的时间戳获取日期/时间。

Syntax:

句法:

    getdate(timestamp);

Parameter(s):

参数:

  • timestamp – It is an optional parameter which specifies the timestamp (which is based on an integer UNIX timestamp) – if we do not pass the timestamp the function returns the local date/time.

    timestamp –这是一个可选参数,用于指定时间戳(基于整数UNIX时间戳)–如果不传递时间戳,该函数将返回本地日期/时间。

Timestamps: Following are the timestamps,

时间戳记 :以下是时间戳记,

  • seconds - it is used to get the time in seconds

    秒 -用于获取时间(以秒为单位)

  • minutes - it is used to get the time in minutes

    分钟 -用于获取以分钟为单位的时间

  • hours - it is used to get the time in hours

    小时 -用于获取小时数

  • mday - it is used to get the day of the month

    mday-用于获取每月的某天

  • wday - it is used to get the day of the week

    wday-用于获取星期几

  • mon - it is used to get the month

    mon-用于获取月份

  • year - it is used to get the year

    年 -用于获取年份

  • yday - it is used to get the day of the year

    yday-用于获取一年中的某天

  • weekday - it is used to get the name of the week

    工作日 -用于获取星期名称

  • month - it is used to get the name of the month

    month-用于获取月份的名称

  • 0 - it is used to get the seconds since Unix Epoch

    0-用于获取自Unix Epoch以来的秒数

Return value:

返回值:

It returns an array of the date/time information with the timestamp

它返回带有时间戳的日期/时间信息数组

Example: PHP code to demonstrate the example of getdate() function

示例:PHP代码演示getdate()函数的示例

<?php
//getting the complete date/time
//i.e. local date/time
$result = getdate();
echo "getdate() result...\n";
print_r($result);
//extracting the indivisual values
//based on the timestamps
echo "seconds:  $result[seconds]\n";
echo "minutes:  $result[minutes]\n";
echo "hours:    $result[hours]\n";
echo "mday:     $result[mday]\n";
echo "wday:     $result[wday]\n";
echo "mon:      $result[mon]\n";
echo "year:     $result[year]\n";
echo "yday:     $result[yday]\n";
echo "weekday:  $result[weekday]\n";
echo "month:    $result[month]\n";
echo "0:        $result[0]\n";
?>

Output

输出量

getdate() result...
Array
(
[seconds] => 28
[minutes] => 56
[hours] => 12
[mday] => 13
[wday] => 2
[mon] => 8
[year] => 2019
[yday] => 224
[weekday] => Tuesday
[month] => August
[0] => 1565700988
)
seconds:  28
minutes:  56
hours:    12
mday:     13
wday:     2
mon:      8
year:     2019
yday:     224
weekday:  Tuesday
month:    August
0:        1565700988

Reference: PHP getdate() function

参考: PHP getdate()函数

翻译自: https://www.includehelp.com/php/getdate-function-with-example.aspx

getdate函数

getdate函数_PHP getdate()函数与示例相关推荐

  1. java回调函数_PHP回调函数及匿名函数概念与用法详解

    1.回调函数 PHP的回调函数其实和C.Java等语言的回调函数的作用是一模一样的,都是在主线程执行的过程中,突然跳去执行设置的回调函数: 回调函数执行完毕之后,再回到主线程处理接下来的流程 而在ph ...

  2. php rename函数_php rename函数怎么用

    PHP rename()函数用于重命名文件或目录,语法"rename(文件旧名称,新名称,句柄环境)",使用用户指定的新名称更改文件或目录的旧名称,并且可以根据需要在目录之间移动: ...

  3. php rename函数_PHP rename函数使用详解(php重命名文件)

    PHP中的rename()函数是一个内置函数,用于重命名文件或目录.它尝试用用户指定的新名称更改文件或目录的旧名称,并且在必要时可以在目录之间移动. 如果用户指定的新名称已经存在,rename()函数 ...

  4. mysql_assoc函数_PHP:MySQL函数mysql_fetch_assoc()的用法

    mysql_fetch_assoc (PHP 4 >= 4.0.3, PHP 5) mysql_fetch_assoc - 从结果集中取得一行作为关联数组 Warning 本扩展自 PHP 5. ...

  5. php 危险函数_PHP 危险函数有哪些?

    在编译 PHP 时,如无特殊需要,一定禁止编译生成 CLI 命令行模式的 PHP 解析支持.可在编译时使用 –disable-CLI.一旦编译生成 CLI 模式的PHP,则可能会被入侵者利用该程序建立 ...

  6. mysql addslashes()函数_PHP addslashes 函数

    一.函数功能: 数据库查询语句的要求,在单引号(').双引号(").反斜线(\)与 NUL(NULL 字符) 等特殊字符前添加反斜杠.它是stripslashes()函数的反向操作函数. 二 ...

  7. mysql rollback函数_PHP mysqli_rollback() 函数_程序员人生

    实例 关闭自动提交,做一些查询,提交查询,然后回滚当前事务: $con=mysqli_connect("localhost","my_user","m ...

  8. php mail函数_php 发送邮件函数

    /** * 记录数据 */ function runlog($mode = 'SMTP',$b = '',$c = '',$d='') { } /** * 发送邮件 * @param $toemail ...

  9. chdir函数_PHP chdir()函数与示例

    chdir函数 PHP chdir()函数 (PHP chdir() function) The full form of chdir is "Change Directory", ...

最新文章

  1. 【机器学习】微软出品!FLAML:一款可以自动化机器学习过程的神器!
  2. py-faster-rcnn代码roidb.py的解读
  3. Linux下查看某个进程的网络带宽占用情况
  4. DeeCamp2019年笔试题A卷
  5. python数据驱动创建账号_Django创建超级管理员账号和修改密码
  6. 利用hdparm工具配合crontab使硬盘不用时休眠
  7. 学术会议html模板,学术会议poster模板
  8. java鼠标钩子,使用setwindowshookex在C#中设置鼠标钩子:wparam和lparam总是返回常量...
  9. canvas中文显示乱码 html5_HTML5 CANVAS:绘制文字
  10. 【系统集成项目管理工程师】项目立项
  11. Docker容器进入的4种方式
  12. 520送对象什么礼物最好?精选4款好用的电容笔
  13. BlogBus居然没有人谈及‘魔方’
  14. VS2019生成Steup文件在其他处理器运行
  15. 汇编语言字符串操作指令movs,和逻辑段寄存器【学习笔记】
  16. 产品,开发,业务的科学吵架指南:每次吵完架后都觉得自己没发挥好怎么办?...
  17. 三本书帮你看淡元宇宙
  18. 共享经济下的共享办公室掀起了另一波逸管家财富浪潮
  19. 【Redis源码剖析】 - Redis持久化之RDB
  20. 商城系统功能需求分析_免费搭建方式介绍_OctShop

热门文章

  1. zblog php 侧边栏样式,ZBlogPHP免费主题Blogs如何修改侧边栏搜索框样式?
  2. 轩逸车联网功能怎么用_北斗已建设完成,那“北斗导航”怎么用?“短报文功能”怎么用?...
  3. 深入理解闭包系列第五篇——闭包的10种形式
  4. random模块详解
  5. vsCode 设置vue 保存自动格式化代码
  6. 手把手教你写一份优质的前端技术简历
  7. CSS的计数器:counter-increment与counter-reset
  8. 辗转相除法求最大公约数(c++)
  9. Remmarguts' Date(POJ2449+最短路+A*算法)
  10. 中国寒龙反网络病毒联盟核心小组:官方公告,近期本站将会发布各种编程技术视频教程,详情请点击我们的以下公告!...