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

PHP
WINDOWS下安装MySQL
PHP 制作 网站/服务器 监视脚本
用PHP和CSS制作活动按钮
PHP 单件模式
PHP MVC模式,类封装以及HACK
PHP 中使用正则表达式
PHP 防止 SQL 注入攻击
PHP 跨站点脚本攻击
PHP 防止用户操纵 GET 变量
PHP 防止远程表单提交

PHP 中的 gmmktime() 函数


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

登陆 | 还没注册?