【发布时间】:2012-12-18 20:10:44
【问题描述】:
我正在尝试使用 PHP 从 SQL 2008 数据库服务器获取当前日期/时间。 当我对返回变量进行转储时,我看到以下内容 -
array (size=1) <br />
'current_date_time' => <br />
object(DateTime)[1] <br />
**public 'date' => string '2012-12-18 15:01:35' (length=19)** <br />
public 'timezone_type' => int 3 <br />
public 'timezone' => string 'UTC' (length=3) <br />
问题:如何仅访问“日期”变量?我尝试了以下但没有奏效:
return $row["current_date_time"]->date
【问题讨论】:
-
“没有工作”是什么意思:你收到错误了吗?
-
是的,我得到一个错误,注意:未定义的属性:C:\wamp\www\cccac\cccac_functions.php 中的 DateTime::$date 在第 378 行
标签: php sql-server datetime