[ create a new paste ] login | about

Link: http://codepad.org/ZPZmXi2x    [ raw code | output | fork ]

PHP, pasted on Jul 2:
1
2
3
4
5
6
7
8
9
10
<?php

class dbResult {
 public $db_timestamp = 1372622987;
}

$dbResult = new dbResult();

$start_date = new DateTime( "{$dbResult->db_timestamp}" );
echo $start_date->format("Y-m-d");


Output:
1
2
3
4
5
6

Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (1372622987) at position 8 (8): Unexpected character' in /t.php:9
Stack trace:
#0 /t.php(9): DateTime->__construct('1372622987')
#1 {main}
  thrown in /t.php on line 9


Create a new paste based on this one


Comments: