[TYPO3-mvc] Ho do you get the timestamp from a DateTime property?
Alexander Dick
typo3 at dick.at
Mon Jan 30 21:29:46 CET 2012
Hi,
Am 30.01.2012 21:01, schrieb Stephen Bungert:
> I have a datetime property which works fine, but now I want to get the
> timestamp and not have a datetime object returned - I want to compare
> the datetime field in a query. What do I have to do to get the timestamp
> (as stored in the database) and not a datetime object/array?
>
> Stephen.
well, you could change your annotations from "DateTime" to "integer",
then the return value should automatically be the timestamp.
/**
* @var integer
*/
protected $date;
/*
* @return integer $date
*/
public function getDate() {
return $this->date;
}
You can also call getTimestamp() on your DateTime object to get the
timestamp.
kind regards
Alex
More information about the TYPO3-project-typo3v4mvc
mailing list