这个问题我这几天也遇到了,你可以换新版的php,或者参考 http://www.php.net/manual/zh/datetime.gettimestamp.php 上的文档说明。里面有讲在php5.2下如何处理的 。 以下摘自文档: 注释 Using U as the parameter to DateTime::format() is an alternative when using PHP 5.2. 例子: <?php $date = new DateTime("1899-12-31"); // "-2209078800" echo $date->format("U"); // false echo $date->getTimestamp(); ?> 总的来说就是使用 $date->$date->format("U");代替$date->getTimestamp(); 我在xgcalendar上更改了就可以运行了。
根据官方的说法:对于php<=5.2的 Using U as the parameter to DateTime::format() is an alternative when using PHP 5.2.也就是用$date = new DateTime("1899-12-31"); $timestamp=$date->format("U"); 代替原来的$date->getTimestamp();即可
不行啊,有些地方不对啊
http://code.google.com/p/xgcalendar/
date_default_timezone_set('Asia/Shanghai');
$timestamp=time();
?>或者
<?php
date_default_timezone_set('Asia/Shanghai');
$date="2011-08-13 12:00:00";
$timestamp=strtotime($date);
?>
http://www.php.net/manual/zh/datetime.gettimestamp.php
上的文档说明。里面有讲在php5.2下如何处理的 。
以下摘自文档:
注释
Using U as the parameter to DateTime::format() is an alternative when using PHP 5.2.
例子:
<?php
$date = new DateTime("1899-12-31");
// "-2209078800"
echo $date->format("U");
// false
echo $date->getTimestamp();
?>
总的来说就是使用 $date->$date->format("U");代替$date->getTimestamp();
我在xgcalendar上更改了就可以运行了。
Using U as the parameter to DateTime::format() is an alternative when using PHP 5.2.也就是用$date = new DateTime("1899-12-31");
$timestamp=$date->format("U");
代替原来的$date->getTimestamp();即可