0

I have an array object like this

DateTime Object(
[date] => 2016-03-15 01:59:40
[timezone_type] => 3
[timezone] => Asia/Singapore)

I want to get the value of date without h:i:s means i want the output like : 2016-03-15

How can i get the value in this format.

user3056158
  • 707
  • 2
  • 13
  • 20
  • 1
    That's not an array, it's a `DateTime` object. Look at the [format()](http://php.net/manual/en/datetime.format.php) function to get the value in the format you want. – jszobody Mar 15 '16 at 18:14

1 Answers1

0

This isn't an array object - this is an DateTime Object. You could use the format method to get your desired output.

$ret = $date->format('Y-m-d');
Philipp
  • 15,377
  • 4
  • 35
  • 52