All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
Atlas快速入门之实战Atlas_.net资料_编程技术
ASP.NET入门数据篇_[Asp.Net教程]
Asp.Net,构架
Apache指南:.htaccess文件使用手册_php资料_编程技术
PHP实例:PHP取GB2312编码字符串首字母的方法_php资料_编程技术
ASP.NET,MVC+LINQ开发一个图书销售站点(7)-图书分类管理_[Asp.Net教程]
利用.net反射动态调用指定程序集的中的方法_[Asp.Net教程]
visual c++添加菜单命令处理函数
web标准实现高效开发_[Html教程]
[delphi语法8]delphi中For语句的使用实例
Reading number is top 10 pictures
Men don't mature ten sign
Sora aoi mirror memorial classics4
HongMenYan premiere XinLiangGong clairvoyant outfit PK YiFeiLiu1
Steal to eat bacon bird
Female model behind the bitterness, often being overcharged3
乳娘帕梅拉安德森1
徐若瑄展示美丽胸围2
Born After 90 Beijing sports university campus flower photos4
美女和狗狗2
The dog buy the ham oneself
Download software ranking
天龙八部十二宫服务端
电车之狼R
XML+Web+Service开发教程
Tram sex maniac 2 (H) rar bag1
Kung fu panda - the secret of the teacher
Sora aoi, the nurse, uniform ,nursing assistant
圣殿祭司的ASP.NET.2.0.开发详解-使用C#
Boxer's Top ten classic battle1
徐若瑄成名作“魔鬼天使”
软件工程思想
归海一刀 published in(发表于) 2014/2/17 7:37:42 Edit(编辑)
PHP日期和时间函数使用技巧实例_[PHP教程]

PHP日期和时间函数使用技巧实例_[PHP教程]

PHP日期和时间函数使用技巧实例_[PHP教程]
checkdate($month,$date,$year)
如果应用的值构成一个有效日期,则该函数返回为真。例如,对于错误日期2005年2月31日,此函数返回为假。
在日期用于计算或保存在数据库中之前,可用此函数检查日期并使日期生效。

// returns false
echo checkdate(2,30,2005) ? "valid" : "invalid";
// returns true
echo checkdate(4,6,2010) ? "valid" : "invalid";
?>

getdate($ts)
在没有自变量的情况下,该函数以结合数组的方式返回当前日期与时间。数组中的每个元素代表日期/时间值中的一个特定组成部分。可向函数提交可选的时间标签自变量,以获得与时间标签对应的日期/时间值。
应用此函数来获得一系列离散的,容易分离的日期/时间值。

// get date as associative array
$arr = getdate();
echo "Date is " . $arr[’mday’] . " " . $arr[’weekday’] . " " . $arr[’year’];
echo "Time is " . $arr[’hours’] . ":" . $arr[’minutes’];
?>

mktime($hour, $minute, $second, $month, $day, $year)
此函数的作用与getdate()的作用相反:它由一系列的日期与时间值生成一个UNIX时间标签(GMT时间1970年1月1日到现在消逝的秒数)。不用自变量时,它生成当前时间的UNIX时间标签。
用此函数获得即时时间的UNIX时间标签。这种时间标签通常用于许多数据库与程序语言中。

// returns timestamp for 13:15:23 7-Jun-2006
echo mktime(13,15,23,6,7,2006);
?>

date($format, $ts)
此函数将UNIX时间标签格式化成一个可人为阅读的日期字符串。它是PHP日期/时间API中功能最为强大的函数,可用在一系列的修正值中,将整数时间标签转变为所需的字符串格式。
为显示格式化时间或日期时,应用此函数。

// format current date
// returns "13-Sep-2005 01:16 PM"
echo date("d-M-Y h:i A", mktime());
?>

strtotime($str)
此函数将可人为阅读的英文日期/时间字符串转换成UNIX时间标签。
应用此函数将非标准化的日期/时间字符串转换成标准、兼容的UNIX时间标签。

// returns 13-Sep-05
echo date("d-M-y", strtotime("today"));
// returns 14-Sep-05
echo date("d-M-y", strtotime("tomorrow"));
// returns 16-Sep-05
echo date("d-M-y", strtotime("today +3 days"));
?>


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.