当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > idate() 函数

PHP
PHP 安全邮件
MySQL 介绍
连接 MySQL
创建 MySQL
MySQL 插入记录
MySQL 选择记录
MySQL Where
MySQL Order By
MySQL 记录更新
MySQL 删除记录
PHP ODBC
XML Expat Parser
XML SimpleXML
PHP 数组参考
PHP Calendar
PHP Date
PHP Directory
PHP Filesystem
PHP FTP
PHP HTTP

PHP 中的 idate() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 469 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The idate() function formats a local time or date as integer.
idate()函数的作用是:将本地时间日期格式化为整数形式。

Syntax
语法

idate(format,timestamp)

Parameter参数 Description描述
format Required. Specifies how to return the result:
必要参数。指定返回结果的形式:
  • B - Swatch Beat/Internet Time
    B – Swatch Beat/Internet时间
  • d - Day of the month
    d – 表示某个月份中的星期几
  • h - Hour (12 hour format)
    h – 小时(12小时格式)
  • H - Hour (24 hour format)
    H – 小时(24小时格式)
  • i - Minutes
    I – 分钟
  • I - returns 1 if DST (daylight saving time) is activated, 0 otherwise
    I – 如果使用夏令时[DST:daylight saving time],则返回1;如不是则返回0
  • L - returns 1 for leap year, 0 otherwise
    L – 如果是闰年则返回1;如果不是则返回0
  • m - Month number
    m – 表示月份的数字
  • s - Seconds
    s – 秒
  • t - Days in current month
    t – 当前月中包含的天数
  • U - Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
    U – Unix Epoch[1970年1月1日 00:00:00 GMT]开始经过的描述
  • w - Day of the week (Sunday=0)
    w – 表示以星期中的星期几(Sunday[星期日]=0)
  • W - ISO-8601 week number of year (week starts on Monday)
    W – ISO-8601标准下一年中包含的星期的数量(从星期一开始计算)
  • y - Year (1 or 2 digits)
    y – 年份(1位数字或两位数字)
  • Y - Year (4 digits)
    Y – 年份(4位数字)
  • z - Day of the year
    z – 表示一年中的星期几
  • Z - Timezone offset in seconds
    Z – 时区从开始时经过的秒数[Timezone offset in seconds]
timestamp Optional. Specifies the date or time to be formatted. If no timestamp is specified, it uses the current local time.
可选参数。指定需要被定义的日期和时间。如果没有指定时间戳,那么它将默认使用本地时间。


Tips and Notes
注意点

Note: This function accepts just one character in the format parameter!
注意:这个函数只接受“format”参数中的一个字符的定义形式,见下面的案例。


Example
案例

<?php
echo(idate("Y"));
?>

The output of the code above could be:
上述代码将输出下面的结果:

2006

评论 (0) All

登陆 | 还没注册?