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

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 中的 gmmktime() 函数


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

Definition and Usage
定义和用法

The gmmktime() function returns a Unix timestamp for a GMT date.
gmmktime()函数的作用是:返回一个GMT日期的UNIX时间戳。

Syntax
语法

gmmktime(hour,minute,second,month,day,year,is_dst)

Parameter参数 Description描述
hour Optional. Specifies the hour
可选参数。指定小时
minute Optional. Specifies the minute
可选参数。指定分钟
second Optional. Specifies the second
可选参数。指定秒数
month Optional. Specifies the numerical month
可选参数。指定月份
day Optional. Specifies the day
可选参数。指定日
year Optional. Specifies the year. The valid range for year is on some systems between 1901 and 2038. However this limitation is overcome in PHP 5
可选参数。指定年份。在有些系统中,年份是基于1901年和2038年之间的。然而这些旨在PHP 5以上的版本中支持
is_dst Optional. Set this parameter to 1 if the time is during daylight savings time (DST), 0 if it is not, or -1 (the default) if it is unknown. If it's unknown, PHP tries to find out itself (which may cause unexpected results). Note: This parameter became deprecated in PHP 5. The new timezone handling features should be used instead
可选参数。如果是夏令时[dst],则此参数为1;如不是则为0;如果不确定则为-1。如果是不确定的情况,那么PHP将会自行查找结果(这可能导致不可预想的结果)
注意:我们不提倡在PHP 5种使用该参数。我们应该使用别的方法来代替使用这种“新时区处理方法”


Tips and Notes
提示

Tip: This function is identical to mktime() except the passed parameters represents a GMT date.
提示:gmmktime()函数与mktime()函数大致相同,唯一的不同是gmmktime()函数传递的是GMT格式的日期。


Example
案例

<?php
$my_birthday = gmmktime(0,0,0,10,3,1975);
print($my_birthday . "<br />");
print(date("M-d-Y",$my_birthday));
?>

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

181526400
Oct-03-1975 

评论 (0) All

登陆 | 还没注册?