I am trying to get the current date/time from SQL 2008 database server using PHP.
When I do a dump on the return variable I see the following –
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 />
Question: How do I access the ‘date’ variable only? I tried the following but did not work:
return $row["current_date_time"]->date
Should do what you need. It looks like
$row["current_date_time"]is a DateTime object.