Datetime format started_at and ended_at PHP problem

Date needs to be formatted as per RFC3339

The error you are getting is a PHP error not a TwitchAPI error, I believe.

You are also setting ended at to before started at. Which is back to front.

Try this instead:

$started_at = date(DATE_RFC3339, time() - 86400);
$ended_at = date(DATE_RFC3339);