Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json Symfony 2使用条令2检索日期字段_Json_Symfony_Doctrine Orm - Fatal编程技术网

Json Symfony 2使用条令2检索日期字段

Json Symfony 2使用条令2检索日期字段,json,symfony,doctrine-orm,Json,Symfony,Doctrine Orm,我有一张名为“PatientIdentification”的桌子。我试图检索一些列并以json格式输出 但在输出中,“datetime”或“date”列类型的值不会输出输入的日期或datetime,而是显示以下内容: "dateofbirth":{"lastErrors":{"warning_count":0,"warnings":[],"error_count":0,"errors":[]},"timezone":{"name":"Europe\/Berlin","location":{"co

我有一张名为“PatientIdentification”的桌子。我试图检索一些列并以json格式输出

但在输出中,“datetime”或“date”列类型的值不会输出输入的日期或datetime,而是显示以下内容:

"dateofbirth":{"lastErrors":{"warning_count":0,"warnings":[],"error_count":0,"errors":[]},"timezone":{"name":"Europe\/Berlin","location":{"country_code":"DE","latitude":52.5,"longitude":13.36666,"comments":"most locations"}},"offset":3600,"timestamp":-91760400}
有人能帮我在这里找到问题,以便正确检索日期吗?

您想要的可能是:

$dateofbirth->format('Y-m-d H:i:s')

完美的这就是getter现在的样子。/***Get-dateofbirth**@return\DateTime*/public function getDateofbirth(){return$this->dateofbirth->format('Y-m-dh:i:s');}