I am trying to get the timestamp in php. Using following code
$date = new DateTime();
echo $date->getTimestamp();
error comes getTimestamp() is undefined
however according to this
I need the format like 123456789
Note the PHP 5 >= 5.3.0
on the doc page. I can only assume you're using a version pre-5.3, therefore:
echo time(); //output: 1358796864
Make sure you are running PHP 5.3 or newer. It doesn't work in PHP 5.2 or older
Perhaps this would be helpful: http://php.net/manual/en/function.date.php