I am working on a php code as shown below:
echo "<pre>";print_r($episode);echo "</pre>";
The above php code displays the following o/p:
stdClass Object
(
[air_date] => 2019-04-15 07:15:00
[air_duration] => 9900
[schedule_id] => 4220986
[program_id] => 23
)
Now on doing print_r($episode->air_date); it displays the following o/p:
2019-04-15 07:15:00
Problem Statement:
I am wondering what changes I need to make here print_r($episode->air_date); so that it displays only date, not the time.
If you're just looking to print, you could just print the substring from the beginning to the position of the first space:
print(substr($episode->air_date, 0, strpos($episode->air_date, ' ')));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With