21xrx.com
2024-04-19 17:42:34 Friday
登录
文章检索 我的文章 写文章
PHP date()函数
2021-12-12 22:01:18 深夜i     --     --
PHP日期()函数

 

格式化本地日期和时间并返回格式化的日期字符串:

<?php
// Prints the day
echo date("l") . "<br>";

// Prints the day, date, month, year, time, AM or PM
echo date("l jS \of F Y h:i:s A");
?>

定义和用法

date()函数格式化本地日期和时间,并返回格式化的日期字符串。


句法

date(format, timestamp)

参数值

参数 描述
format

必需的。指定输出日期字符串的格式。可以使用以下字符

timestamp 可选。 指定整数UNIX时间戳。 默认值是当前本地时间(时间())


技术细节

返回值: 返回成功的格式化日期字符串。 错误失败+ e_warning
PHP版本: 4+
changelog: PHP 5.1.0:添加了e_strict和e_notice时区错误。 有效的时间戳现在是来自周五,1901年12月13日20:45:54 GMT到Tue,1月19日03:14:07 GMT。 在5.1.0时间戳之前,在某些系统(例如Windows)中的01-01-1970至19-01-2038中受到限制(例如,Windows).php 5.1.1:添加可用于指定格式参数的标准日期/时间格式的常量

 

 

  
  

评论区

{{item['qq_nickname']}}
()
回复
回复
    相似文章