我不明白:
$ts = strval( $this->get_start_date() ); // retrieve (int) timestamp from database
$time = new DateTime ( $ts );
// throws an exception:
//'DateTime::__construct(): Failed to parse time string
//(1346284800) at position 7 (8): Unexpected character'
$time = new DateTime();
$time->setTimestamp( $ts );
//works fine
知道这里发生了什么吗?我正在使用
PHP 5.3.10-1ubuntu3.2 with Suhosin-Patch (cli) (built: Jun 13 2012 17:19:58)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies