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

PHP
PHP Libxml
PHP Math
PHP Misc
PHP MySQL
PHP SimpleXML
PHP String
PHP XML
PHP Zip
PHP Mail
用PHP5的DirectoryIterators递归扫描目录
PHP 阻止SQL注入式攻击
PHP5面向对象 - 基础 - 类和对象
PHP5面向对象 - 基础 - 类的属性( public )
PHP5面向对象 - 基础 - 类的属性( private )
PHP5面向对象 - 基础 - 方法
PHP5面向对象 - 基础 - 对象的比较
php5面向对象 - 基础 - 构造函数
php5面向对象 - 基础 - 析构函数
用PHP控制用户的浏览器 - ob*函数的使用
PHP PDO 学习笔记

PHP 中的 idate() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 468 ::
收藏到网摘: 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

登陆 | 还没注册?