?php /** * @company xingquan * @auther BianJiang * @date Mon Mar 03 11:03:15 CST 2008 * @copyright Shen Yang Xing Quan * @todo 计算指定日期后5天的日期 * @desc strtotime将任何英文文本的日期时间描述解析为 Unix 时间戳 * strtotime处理日期相关的任务非常实用与灵活 */ $timestamp = mktime(0, 0, 0, 3, 3, 2008); //在当...
by liuxingyuyuni - php文档中心 - 2008-03-03 11:35:30 阅读(409) 回复(0)
php的 strtotime在转换日期字符串是如果使用 date('Y-m', strtotime('-3 months')); 如果当前月份有31天的话则计算出来的月份会出现错误 比如 已 2009-07-31来算的话 date('Y-m', strtotime('-3 months')); date('Y-m', strtotime('-2 months')); 最后的结果都是 2009-05 解决的办法是 date('Y-m', strtotime('-3 months ' . date('Y-m-01', time()) )); 取当前月的第一天
$date1 = date('Y-m-d','H:i:s'); $date2 = '2008-08-08 10:10:10'; $tm = strtotime($date1) - strtotime($date2); echo $tm; //这个 $tm 是不是就是以秒计的两者的时间差?
$result=mysql_query("select strtotime(字段名) as last_update from ecs_goods", $dbcnx); 上面的这条查询语句执行结果失败,我测试只有这条查询语句执行成功后再这样运行strtotime()才算可以: strtotime($row[字段名]); 这有这样才能成功运用strtotime()函数,但我在构造SQL语句时运用date_format()函数就可以啊,为何运用strtotime()就不行了呢?手册看来看去的也没看明白,在此向大家求助了,如果要在SQL语句中运用strtoti...
[color="#02368d"]strtotime将文本日期时间解析为Unix时间戳 http://blog.chinaunix.net/u/13329/showart.php?id=165832 echo strtotime("2006-01-09 08:10"); echo strtotime("now"); echo strtotime("10 September 2000"); echo strtotime("+1 day"); echo strtotime("+1 week"); echo strtotime("+1 week 2 days 4 hours 2 seconds"); echo strtotime("next Thursday"); echo strtotime("last Monday"); ?> .今日日期号 $days=d...
echo strtotime("2006-01-09 08:10"); echo strtotime("now"); echo strtotime("10 September 2000"); echo strtotime("+1 day"); echo strtotime("+1 week"); echo strtotime("+1 week 2 days 4 hours 2 seconds"); echo strtotime("next Thursday"); echo strtotime("last Monday"); ?> .今日日期号 $days=date('d',strtotime('now')); //2006-09-06 .当前月月初 echo $currMBegin=date("Y-m", strtotime('now'))."-01 &...
有个问题困扰我多日了 我的论坛(phpwind4)时间老是出现混乱 有时正确 有时跳回格林尼治标准时间(慢了8个小时) 后来发现 是strtotime函数在作怪 是要打开的某个程序要执行strtotime这个函数 马上论坛所有的发贴时间全部变成格林尼治标准时间 于是我做了试验 运行以下两段代码: date("D M j G:i:s T Y",strtotime ("now")); 结果显示 Sat Dec 17 15:35:00 UTC 2005 (服务器明明是CST 中国标准时间啊) 而date("D M j ...